<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998

-}</span><span>
</span><span id="line-6"></span><span>
</span><span id="line-7"></span><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-8"></span><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
</span><span id="line-9"></span><span class="hs-pragma">{-# LANGUAGE RankNTypes #-}</span><span>
</span><span id="line-10"></span><span class="hs-pragma">{-# LANGUAGE TupleSections #-}</span><span>
</span><span id="line-11"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
</span><span id="line-12"></span><span class="hs-pragma">{-# LANGUAGE ViewPatterns #-}</span><span>
</span><span id="line-13"></span><span>
</span><span id="line-14"></span><span class="hs-pragma">{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}</span><span>
</span><span id="line-15"></span><span>
</span><span id="line-16"></span><span class="hs-comment">-- | Typechecking patterns</span><span>
</span><span id="line-17"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Tc.Gen.Pat</span><span>
</span><span id="line-18"></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcLetPat"><span class="hs-identifier">tcLetPat</span></a></span><span>
</span><span id="line-19"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#newLetBndr"><span class="hs-identifier">newLetBndr</span></a></span><span>
</span><span id="line-20"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetBndrSpec"><span class="hs-identifier">LetBndrSpec</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-21"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcCheckPat"><span class="hs-identifier">tcCheckPat</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcCheckPat_O"><span class="hs-identifier">tcCheckPat_O</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcInferPat"><span class="hs-identifier">tcInferPat</span></a></span><span>
</span><span id="line-22"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcPats"><span class="hs-identifier">tcPats</span></a></span><span>
</span><span id="line-23"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#addDataConStupidTheta"><span class="hs-identifier">addDataConStupidTheta</span></a></span><span>
</span><span id="line-24"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#badFieldCon"><span class="hs-identifier">badFieldCon</span></a></span><span>
</span><span id="line-25"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#polyPatSig"><span class="hs-identifier">polyPatSig</span></a></span><span>
</span><span id="line-26"></span><span>   </span><span class="hs-special">)</span><span>
</span><span id="line-27"></span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-32"></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span>   </span><span class="annot"><a href="GHC.Tc.Gen.Expr.html"><span class="hs-identifier">GHC.Tc.Gen.Expr</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Expr.html#tcSyntaxOp"><span class="hs-identifier">tcSyntaxOp</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Expr.html#tcSyntaxOpGen"><span class="hs-identifier">tcSyntaxOpGen</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Expr.html#tcInferRho"><span class="hs-identifier">tcInferRho</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-34"></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Hs.html"><span class="hs-identifier">GHC.Hs</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Zonk.html"><span class="hs-identifier">GHC.Tc.Utils.Zonk</span></a></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Sig.html"><span class="hs-identifier">GHC.Tc.Gen.Sig</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Sig.html#TcPragEnv"><span class="hs-identifier">TcPragEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Sig.html#lookupPragEnv"><span class="hs-identifier">lookupPragEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Sig.html#addInlinePrags"><span class="hs-identifier">addInlinePrags</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html"><span class="hs-identifier">GHC.Tc.Utils.Monad</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Instantiate.html"><span class="hs-identifier">GHC.Tc.Utils.Instantiate</span></a></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.html"><span class="hs-identifier">GHC.Types.Var</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html"><span class="hs-identifier">GHC.Types.Name.Reader</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Multiplicity.html"><span class="hs-identifier">GHC.Core.Multiplicity</span></a></span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Env.html"><span class="hs-identifier">GHC.Tc.Utils.Env</span></a></span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcMType.html"><span class="hs-identifier">GHC.Tc.Utils.TcMType</span></a></span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Validity.html"><span class="hs-identifier">GHC.Tc.Validity</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Validity.html#arityErr"><span class="hs-identifier">arityErr</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html"><span class="hs-identifier">GHC.Core.TyCo.Ppr</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html#pprTyVars"><span class="hs-identifier">pprTyVars</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html"><span class="hs-identifier">GHC.Tc.Utils.TcType</span></a></span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Unify.html"><span class="hs-identifier">GHC.Tc.Utils.Unify</span></a></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.HsType.html"><span class="hs-identifier">GHC.Tc.Gen.HsType</span></a></span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html"><span class="hs-identifier">GHC.Builtin.Types</span></a></span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html"><span class="hs-identifier">GHC.Tc.Types.Evidence</span></a></span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html"><span class="hs-identifier">GHC.Tc.Types.Origin</span></a></span><span>
</span><span id="line-55"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html"><span class="hs-identifier">GHC.Core.DataCon</span></a></span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.PatSyn.html"><span class="hs-identifier">GHC.Core.PatSyn</span></a></span><span>
</span><span id="line-58"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.ConLike.html"><span class="hs-identifier">GHC.Core.ConLike</span></a></span><span>
</span><span id="line-59"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html"><span class="hs-identifier">GHC.Builtin.Names</span></a></span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#SuccessFlag"><span class="hs-identifier">SuccessFlag</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-62"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html"><span class="hs-identifier">GHC.Types.Var.Set</span></a></span><span>
</span><span id="line-64"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-65"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Outputable</span></span><span>
</span><span id="line-66"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.LanguageExtensions.html#"><span class="hs-identifier">GHC.LanguageExtensions</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">LangExt</span></span><span>
</span><span id="line-67"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Arrow.html#"><span class="hs-identifier">Control.Arrow</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Control.Arrow.html#second"><span class="hs-identifier">second</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-68"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier">when</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-69"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.List.SetOps.html"><span class="hs-identifier">GHC.Data.List.SetOps</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Data.List.SetOps.html#getNth"><span class="hs-identifier">getNth</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-70"></span><span>
</span><span id="line-71"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                External interface
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-78"></span><span>
</span><span id="line-79"></span><span id="local-6989586621681122353"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcLetPat"><span class="hs-identifier hs-type">tcLetPat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier hs-type">TcId</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-80"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetBndrSpec"><span class="hs-identifier hs-type">LetBndrSpec</span></a></span><span>
</span><span id="line-81"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpSigmaType"><span class="hs-identifier hs-type">ExpSigmaType</span></a></span><span>
</span><span id="line-82"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681122353"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-83"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681122353"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-84"></span><span id="tcLetPat"><span class="annot"><span class="annottext">tcLetPat :: forall a.
(Name -&gt; Maybe TyVar)
-&gt; LetBndrSpec
-&gt; LPat GhcRn
-&gt; Scaled ExpSigmaType
-&gt; TcM a
-&gt; TcM (LPat GhcTc, a)
</span><a href="GHC.Tc.Gen.Pat.html#tcLetPat"><span class="hs-identifier hs-var hs-var">tcLetPat</span></a></span></span><span> </span><span id="local-6989586621681122005"><span class="annot"><span class="annottext">Name -&gt; Maybe TyVar
</span><a href="#local-6989586621681122005"><span class="hs-identifier hs-var">sig_fn</span></a></span></span><span> </span><span id="local-6989586621681122004"><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681122004"><span class="hs-identifier hs-var">no_gen</span></a></span></span><span> </span><span id="local-6989586621681122003"><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681122003"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span id="local-6989586621681122002"><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681122002"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span id="local-6989586621681122001"><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681122001"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-85"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681122000"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621681122000"><span class="hs-identifier hs-var">bind_lvl</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM TcLevel
</span><a href="GHC.Tc.Utils.Monad.html#getTcLevel"><span class="hs-identifier hs-var">getTcLevel</span></a></span><span>
</span><span id="line-86"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121998"><span class="annot"><span class="annottext">ctxt :: PatCtxt
</span><a href="#local-6989586621681121998"><span class="hs-identifier hs-var hs-var">ctxt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LetPat :: TcLevel -&gt; (Name -&gt; Maybe TyVar) -&gt; LetBndrSpec -&gt; PatCtxt
</span><a href="GHC.Tc.Gen.Pat.html#LetPat"><span class="hs-identifier hs-type">LetPat</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pc_lvl :: TcLevel
</span><a href="GHC.Tc.Gen.Pat.html#pc_lvl"><span class="hs-identifier hs-var">pc_lvl</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621681122000"><span class="hs-identifier hs-var">bind_lvl</span></a></span><span>
</span><span id="line-87"></span><span>                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pc_sig_fn :: Name -&gt; Maybe TyVar
</span><a href="GHC.Tc.Gen.Pat.html#pc_sig_fn"><span class="hs-identifier hs-var">pc_sig_fn</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Maybe TyVar
</span><a href="#local-6989586621681122005"><span class="hs-identifier hs-var">sig_fn</span></a></span><span>
</span><span id="line-88"></span><span>                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pc_new :: LetBndrSpec
</span><a href="GHC.Tc.Gen.Pat.html#pc_new"><span class="hs-identifier hs-var">pc_new</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681122004"><span class="hs-identifier hs-var">no_gen</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-89"></span><span>             </span><span id="local-6989586621681121993"><span class="annot"><span class="annottext">penv :: PatEnv
</span><a href="#local-6989586621681121993"><span class="hs-identifier hs-var hs-var">penv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PE :: Bool -&gt; PatCtxt -&gt; CtOrigin -&gt; PatEnv
</span><a href="GHC.Tc.Gen.Pat.html#PE"><span class="hs-identifier hs-type">PE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pe_lazy :: Bool
</span><a href="GHC.Tc.Gen.Pat.html#pe_lazy"><span class="hs-identifier hs-var">pe_lazy</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-90"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pe_ctxt :: PatCtxt
</span><a href="GHC.Tc.Gen.Pat.html#pe_ctxt"><span class="hs-identifier hs-var">pe_ctxt</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PatCtxt
</span><a href="#local-6989586621681121998"><span class="hs-identifier hs-var">ctxt</span></a></span><span>
</span><span id="line-91"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pe_orig :: CtOrigin
</span><a href="GHC.Tc.Gen.Pat.html#pe_orig"><span class="hs-identifier hs-var">pe_orig</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="GHC.Tc.Types.Origin.html#PatOrigin"><span class="hs-identifier hs-var">PatOrigin</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-92"></span><span>
</span><span id="line-93"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; Checker (LPat GhcRn) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpat"><span class="hs-identifier hs-var">tc_lpat</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681122002"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121993"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681122003"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681122001"><span class="hs-identifier hs-var">thing_inside</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-94"></span><span>
</span><span id="line-95"></span><span class="hs-comment">-----------------</span><span>
</span><span id="line-96"></span><span id="local-6989586621681122342"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcPats"><span class="hs-identifier hs-type">tcPats</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#HsMatchContext"><span class="hs-identifier hs-type">HsMatchContext</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span>
</span><span id="line-97"></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span>            </span><span class="hs-comment">-- Patterns,</span><span>
</span><span id="line-98"></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpSigmaType"><span class="hs-identifier hs-type">ExpSigmaType</span></a></span><span class="hs-special">]</span><span>         </span><span class="hs-comment">--   and their types</span><span>
</span><span id="line-99"></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681122342"><span class="hs-identifier hs-type">a</span></a></span><span>                  </span><span class="hs-comment">--   and the checker for the body</span><span>
</span><span id="line-100"></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681122342"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-101"></span><span>
</span><span id="line-102"></span><span class="hs-comment">-- This is the externally-callable wrapper function</span><span>
</span><span id="line-103"></span><span class="hs-comment">-- Typecheck the patterns, extend the environment to bind the variables,</span><span>
</span><span id="line-104"></span><span class="hs-comment">-- do the thing inside, use any existentially-bound dictionaries to</span><span>
</span><span id="line-105"></span><span class="hs-comment">-- discharge parts of the returning LIE, and deal with pattern type</span><span>
</span><span id="line-106"></span><span class="hs-comment">-- signatures</span><span>
</span><span id="line-107"></span><span>
</span><span id="line-108"></span><span class="hs-comment">--   1. Initialise the PatState</span><span>
</span><span id="line-109"></span><span class="hs-comment">--   2. Check the patterns</span><span>
</span><span id="line-110"></span><span class="hs-comment">--   3. Check the body</span><span>
</span><span id="line-111"></span><span class="hs-comment">--   4. Check that no existentials escape</span><span>
</span><span id="line-112"></span><span>
</span><span id="line-113"></span><span id="tcPats"><span class="annot"><span class="annottext">tcPats :: forall a.
HsMatchContext GhcRn
-&gt; [LPat GhcRn]
-&gt; [Scaled ExpSigmaType]
-&gt; TcM a
-&gt; TcM ([LPat GhcTc], a)
</span><a href="GHC.Tc.Gen.Pat.html#tcPats"><span class="hs-identifier hs-var hs-var">tcPats</span></a></span></span><span> </span><span id="local-6989586621681121986"><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681121986"><span class="hs-identifier hs-var">ctxt</span></a></span></span><span> </span><span id="local-6989586621681121985"><span class="annot"><span class="annottext">[LPat GhcRn]
</span><a href="#local-6989586621681121985"><span class="hs-identifier hs-var">pats</span></a></span></span><span> </span><span id="local-6989586621681121984"><span class="annot"><span class="annottext">[Scaled ExpSigmaType]
</span><a href="#local-6989586621681121984"><span class="hs-identifier hs-var">pat_tys</span></a></span></span><span> </span><span id="local-6989586621681121983"><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681121983"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-114"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Scaled ExpSigmaType] -&gt; Checker [LPat GhcRn] [LPat GhcTc]
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpats"><span class="hs-identifier hs-var">tc_lpats</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled ExpSigmaType]
</span><a href="#local-6989586621681121984"><span class="hs-identifier hs-var">pat_tys</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121981"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">[LPat GhcRn]
</span><a href="#local-6989586621681121985"><span class="hs-identifier hs-var">pats</span></a></span><span> </span><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681121983"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-115"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-116"></span><span>    </span><span id="local-6989586621681121981"><span class="annot"><span class="annottext">penv :: PatEnv
</span><a href="#local-6989586621681121981"><span class="hs-identifier hs-var hs-var">penv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PE :: Bool -&gt; PatCtxt -&gt; CtOrigin -&gt; PatEnv
</span><a href="GHC.Tc.Gen.Pat.html#PE"><span class="hs-identifier hs-type">PE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pe_lazy :: Bool
</span><a href="GHC.Tc.Gen.Pat.html#pe_lazy"><span class="hs-identifier hs-var">pe_lazy</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pe_ctxt :: PatCtxt
</span><a href="GHC.Tc.Gen.Pat.html#pe_ctxt"><span class="hs-identifier hs-var">pe_ctxt</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn -&gt; PatCtxt
</span><a href="GHC.Tc.Gen.Pat.html#LamPat"><span class="hs-identifier hs-var">LamPat</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681121986"><span class="hs-identifier hs-var">ctxt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pe_orig :: CtOrigin
</span><a href="GHC.Tc.Gen.Pat.html#pe_orig"><span class="hs-identifier hs-var">pe_orig</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="GHC.Tc.Types.Origin.html#PatOrigin"><span class="hs-identifier hs-var">PatOrigin</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-117"></span><span>
</span><span id="line-118"></span><span id="local-6989586621681122340"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcInferPat"><span class="hs-identifier hs-type">tcInferPat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#HsMatchContext"><span class="hs-identifier hs-type">HsMatchContext</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span>
</span><span id="line-119"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681122340"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-120"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681122340"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcSigmaType"><span class="hs-identifier hs-type">TcSigmaType</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-121"></span><span id="tcInferPat"><span class="annot"><span class="annottext">tcInferPat :: forall a.
HsMatchContext GhcRn
-&gt; LPat GhcRn -&gt; TcM a -&gt; TcM ((LPat GhcTc, a), TcType)
</span><a href="GHC.Tc.Gen.Pat.html#tcInferPat"><span class="hs-identifier hs-var hs-var">tcInferPat</span></a></span></span><span> </span><span id="local-6989586621681121978"><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681121978"><span class="hs-identifier hs-var">ctxt</span></a></span></span><span> </span><span id="local-6989586621681121977"><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121977"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span id="local-6989586621681121976"><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681121976"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-122"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ExpSigmaType -&gt; TcM (Located (Pat GhcTc), a))
-&gt; TcM ((Located (Pat GhcTc), a), TcType)
forall a. (ExpSigmaType -&gt; TcM a) -&gt; TcM (a, TcType)
</span><a href="GHC.Tc.Utils.TcMType.html#tcInfer"><span class="hs-identifier hs-var">tcInfer</span></a></span><span> </span><span class="annot"><span class="annottext">((ExpSigmaType -&gt; TcM (Located (Pat GhcTc), a))
 -&gt; TcM ((Located (Pat GhcTc), a), TcType))
-&gt; (ExpSigmaType -&gt; TcM (Located (Pat GhcTc), a))
-&gt; TcM ((Located (Pat GhcTc), a), TcType)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621681121974"><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681121974"><span class="hs-identifier hs-var">exp_ty</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-123"></span><span>    </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; Checker (LPat GhcRn) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpat"><span class="hs-identifier hs-var">tc_lpat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ExpSigmaType -&gt; Scaled ExpSigmaType
forall a. a -&gt; Scaled a
</span><a href="GHC.Core.Type.html#unrestricted"><span class="hs-identifier hs-var">unrestricted</span></a></span><span> </span><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681121974"><span class="hs-identifier hs-var">exp_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121972"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121977"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681121976"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-124"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-125"></span><span>    </span><span id="local-6989586621681121972"><span class="annot"><span class="annottext">penv :: PatEnv
</span><a href="#local-6989586621681121972"><span class="hs-identifier hs-var hs-var">penv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PE :: Bool -&gt; PatCtxt -&gt; CtOrigin -&gt; PatEnv
</span><a href="GHC.Tc.Gen.Pat.html#PE"><span class="hs-identifier hs-type">PE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pe_lazy :: Bool
</span><a href="GHC.Tc.Gen.Pat.html#pe_lazy"><span class="hs-identifier hs-var">pe_lazy</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pe_ctxt :: PatCtxt
</span><a href="GHC.Tc.Gen.Pat.html#pe_ctxt"><span class="hs-identifier hs-var">pe_ctxt</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn -&gt; PatCtxt
</span><a href="GHC.Tc.Gen.Pat.html#LamPat"><span class="hs-identifier hs-var">LamPat</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681121978"><span class="hs-identifier hs-var">ctxt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pe_orig :: CtOrigin
</span><a href="GHC.Tc.Gen.Pat.html#pe_orig"><span class="hs-identifier hs-var">pe_orig</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="GHC.Tc.Types.Origin.html#PatOrigin"><span class="hs-identifier hs-var">PatOrigin</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-126"></span><span>
</span><span id="line-127"></span><span id="local-6989586621681122333"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcCheckPat"><span class="hs-identifier hs-type">tcCheckPat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#HsMatchContext"><span class="hs-identifier hs-type">HsMatchContext</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span>
</span><span id="line-128"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcSigmaType"><span class="hs-identifier hs-type">TcSigmaType</span></a></span><span>
</span><span id="line-129"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681122333"><span class="hs-identifier hs-type">a</span></a></span><span>                     </span><span class="hs-comment">-- Checker for body</span><span>
</span><span id="line-130"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681122333"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-131"></span><span id="tcCheckPat"><span class="annot"><span class="annottext">tcCheckPat :: forall a.
HsMatchContext GhcRn
-&gt; LPat GhcRn -&gt; Scaled TcType -&gt; TcM a -&gt; TcM (LPat GhcTc, a)
</span><a href="GHC.Tc.Gen.Pat.html#tcCheckPat"><span class="hs-identifier hs-var hs-var">tcCheckPat</span></a></span></span><span> </span><span id="local-6989586621681121971"><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681121971"><span class="hs-identifier hs-var">ctxt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
-&gt; CtOrigin
-&gt; LPat GhcRn
-&gt; Scaled TcType
-&gt; TcM a
-&gt; TcM (LPat GhcTc, a)
forall a.
HsMatchContext GhcRn
-&gt; CtOrigin
-&gt; LPat GhcRn
-&gt; Scaled TcType
-&gt; TcM a
-&gt; TcM (LPat GhcTc, a)
</span><a href="GHC.Tc.Gen.Pat.html#tcCheckPat_O"><span class="hs-identifier hs-var">tcCheckPat_O</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681121971"><span class="hs-identifier hs-var">ctxt</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="GHC.Tc.Types.Origin.html#PatOrigin"><span class="hs-identifier hs-var">PatOrigin</span></a></span><span>
</span><span id="line-132"></span><span>
</span><span id="line-133"></span><span class="hs-comment">-- | A variant of 'tcPat' that takes a custom origin</span><span>
</span><span id="line-134"></span><span id="local-6989586621681122331"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcCheckPat_O"><span class="hs-identifier hs-type">tcCheckPat_O</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#HsMatchContext"><span class="hs-identifier hs-type">HsMatchContext</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span>
</span><span id="line-135"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html#CtOrigin"><span class="hs-identifier hs-type">CtOrigin</span></a></span><span>              </span><span class="hs-comment">-- ^ origin to use if the type needs inst'ing</span><span>
</span><span id="line-136"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcSigmaType"><span class="hs-identifier hs-type">TcSigmaType</span></a></span><span>
</span><span id="line-137"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681122331"><span class="hs-identifier hs-type">a</span></a></span><span>                 </span><span class="hs-comment">-- Checker for body</span><span>
</span><span id="line-138"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681122331"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-139"></span><span id="tcCheckPat_O"><span class="annot"><span class="annottext">tcCheckPat_O :: forall a.
HsMatchContext GhcRn
-&gt; CtOrigin
-&gt; LPat GhcRn
-&gt; Scaled TcType
-&gt; TcM a
-&gt; TcM (LPat GhcTc, a)
</span><a href="GHC.Tc.Gen.Pat.html#tcCheckPat_O"><span class="hs-identifier hs-var hs-var">tcCheckPat_O</span></a></span></span><span> </span><span id="local-6989586621681121970"><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681121970"><span class="hs-identifier hs-var">ctxt</span></a></span></span><span> </span><span id="local-6989586621681121969"><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621681121969"><span class="hs-identifier hs-var">orig</span></a></span></span><span> </span><span id="local-6989586621681121968"><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121968"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span id="local-6989586621681121966"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121966"><span class="hs-identifier hs-var">pat_mult</span></a></span></span><span> </span><span id="local-6989586621681121965"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121965"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681121964"><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681121964"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-140"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; Checker (LPat GhcRn) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpat"><span class="hs-identifier hs-var">tc_lpat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType -&gt; Scaled ExpSigmaType
forall a. TcType -&gt; a -&gt; Scaled a
</span><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-var">Scaled</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121966"><span class="hs-identifier hs-var">pat_mult</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121965"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121962"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121968"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681121964"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-141"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-142"></span><span>    </span><span id="local-6989586621681121962"><span class="annot"><span class="annottext">penv :: PatEnv
</span><a href="#local-6989586621681121962"><span class="hs-identifier hs-var hs-var">penv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PE :: Bool -&gt; PatCtxt -&gt; CtOrigin -&gt; PatEnv
</span><a href="GHC.Tc.Gen.Pat.html#PE"><span class="hs-identifier hs-type">PE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pe_lazy :: Bool
</span><a href="GHC.Tc.Gen.Pat.html#pe_lazy"><span class="hs-identifier hs-var">pe_lazy</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pe_ctxt :: PatCtxt
</span><a href="GHC.Tc.Gen.Pat.html#pe_ctxt"><span class="hs-identifier hs-var">pe_ctxt</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn -&gt; PatCtxt
</span><a href="GHC.Tc.Gen.Pat.html#LamPat"><span class="hs-identifier hs-var">LamPat</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681121970"><span class="hs-identifier hs-var">ctxt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pe_orig :: CtOrigin
</span><a href="GHC.Tc.Gen.Pat.html#pe_orig"><span class="hs-identifier hs-var">pe_orig</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621681121969"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-143"></span><span>
</span><span id="line-144"></span><span>
</span><span id="line-145"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                PatEnv, PatCtxt, LetBndrSpec
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-152"></span><span>
</span><span id="line-153"></span><span class="hs-keyword">data</span><span> </span><span id="PatEnv"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PatEnv"><span class="hs-identifier hs-var">PatEnv</span></a></span></span><span>
</span><span id="line-154"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="PE"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PE"><span class="hs-identifier hs-var">PE</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="pe_lazy"><span class="annot"><span class="annottext">PatEnv -&gt; Bool
</span><a href="GHC.Tc.Gen.Pat.html#pe_lazy"><span class="hs-identifier hs-var hs-var">pe_lazy</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>        </span><span class="hs-comment">-- True &lt;=&gt; lazy context, so no existentials allowed</span><span>
</span><span id="line-155"></span><span>       </span><span class="hs-special">,</span><span> </span><span id="pe_ctxt"><span class="annot"><span class="annottext">PatEnv -&gt; PatCtxt
</span><a href="GHC.Tc.Gen.Pat.html#pe_ctxt"><span class="hs-identifier hs-var hs-var">pe_ctxt</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PatCtxt"><span class="hs-identifier hs-type">PatCtxt</span></a></span><span>     </span><span class="hs-comment">-- Context in which the whole pattern appears</span><span>
</span><span id="line-156"></span><span>       </span><span class="hs-special">,</span><span> </span><span id="pe_orig"><span class="annot"><span class="annottext">PatEnv -&gt; CtOrigin
</span><a href="GHC.Tc.Gen.Pat.html#pe_orig"><span class="hs-identifier hs-var hs-var">pe_orig</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html#CtOrigin"><span class="hs-identifier hs-type">CtOrigin</span></a></span><span>    </span><span class="hs-comment">-- origin to use if the pat_ty needs inst'ing</span><span>
</span><span id="line-157"></span><span>       </span><span class="hs-special">}</span><span>
</span><span id="line-158"></span><span>
</span><span id="line-159"></span><span class="hs-keyword">data</span><span> </span><span id="PatCtxt"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PatCtxt"><span class="hs-identifier hs-var">PatCtxt</span></a></span></span><span>
</span><span id="line-160"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="LamPat"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LamPat"><span class="hs-identifier hs-var">LamPat</span></a></span></span><span>   </span><span class="hs-comment">-- Used for lambdas, case etc</span><span>
</span><span id="line-161"></span><span>       </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#HsMatchContext"><span class="hs-identifier hs-type">HsMatchContext</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="LetPat"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetPat"><span class="hs-identifier hs-var">LetPat</span></a></span></span><span>   </span><span class="hs-comment">-- Used only for let(rec) pattern bindings</span><span>
</span><span id="line-164"></span><span>             </span><span class="hs-comment">-- See Note [Typing patterns in pattern bindings]</span><span>
</span><span id="line-165"></span><span>       </span><span class="hs-special">{</span><span> </span><span id="pc_lvl"><span class="annot"><span class="annottext">PatCtxt -&gt; TcLevel
</span><a href="GHC.Tc.Gen.Pat.html#pc_lvl"><span class="hs-identifier hs-var hs-var">pc_lvl</span></a></span></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span>
</span><span id="line-166"></span><span>                   </span><span class="hs-comment">-- Level of the binding group</span><span>
</span><span id="line-167"></span><span>
</span><span id="line-168"></span><span>       </span><span class="hs-special">,</span><span> </span><span id="pc_sig_fn"><span class="annot"><span class="annottext">PatCtxt -&gt; Name -&gt; Maybe TyVar
</span><a href="GHC.Tc.Gen.Pat.html#pc_sig_fn"><span class="hs-identifier hs-var hs-var">pc_sig_fn</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier hs-type">TcId</span></a></span><span>
</span><span id="line-169"></span><span>                   </span><span class="hs-comment">-- Tells the expected type</span><span>
</span><span id="line-170"></span><span>                   </span><span class="hs-comment">-- for binders with a signature</span><span>
</span><span id="line-171"></span><span>
</span><span id="line-172"></span><span>       </span><span class="hs-special">,</span><span> </span><span id="pc_new"><span class="annot"><span class="annottext">PatCtxt -&gt; LetBndrSpec
</span><a href="GHC.Tc.Gen.Pat.html#pc_new"><span class="hs-identifier hs-var hs-var">pc_new</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetBndrSpec"><span class="hs-identifier hs-type">LetBndrSpec</span></a></span><span>
</span><span id="line-173"></span><span>                </span><span class="hs-comment">-- How to make a new binder</span><span>
</span><span id="line-174"></span><span>       </span><span class="hs-special">}</span><span>        </span><span class="hs-comment">-- for binders without signatures</span><span>
</span><span id="line-175"></span><span>
</span><span id="line-176"></span><span class="hs-keyword">data</span><span> </span><span id="LetBndrSpec"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetBndrSpec"><span class="hs-identifier hs-var">LetBndrSpec</span></a></span></span><span>
</span><span id="line-177"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="LetLclBndr"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetLclBndr"><span class="hs-identifier hs-var">LetLclBndr</span></a></span></span><span>            </span><span class="hs-comment">-- We are going to generalise, and wrap in an AbsBinds</span><span>
</span><span id="line-178"></span><span>                          </span><span class="hs-comment">-- so clone a fresh binder for the local monomorphic Id</span><span>
</span><span id="line-179"></span><span>
</span><span id="line-180"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="LetGblBndr"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetGblBndr"><span class="hs-identifier hs-var">LetGblBndr</span></a></span></span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Sig.html#TcPragEnv"><span class="hs-identifier hs-type">TcPragEnv</span></a></span><span>  </span><span class="hs-comment">-- Generalisation plan is NoGen, so there isn't going</span><span>
</span><span id="line-181"></span><span>                          </span><span class="hs-comment">-- to be an AbsBinds; So we must bind the global version</span><span>
</span><span id="line-182"></span><span>                          </span><span class="hs-comment">-- of the binder right away.</span><span>
</span><span id="line-183"></span><span>                          </span><span class="hs-comment">-- And here is the inline-pragma information</span><span>
</span><span id="line-184"></span><span>
</span><span id="line-185"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681121957"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetBndrSpec"><span class="hs-identifier hs-type">LetBndrSpec</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-186"></span><span>  </span><span id="local-6989586621681121955"><span class="annot"><span class="annottext">ppr :: LetBndrSpec -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="GHC.Tc.Gen.Pat.html#LetLclBndr"><span class="hs-identifier hs-var">LetLclBndr</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;LetLclBndr&quot;</span></span><span>
</span><span id="line-187"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetGblBndr"><span class="hs-identifier hs-type">LetGblBndr</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;LetGblBndr&quot;</span></span><span>
</span><span id="line-188"></span><span>
</span><span id="line-189"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#makeLazy"><span class="hs-identifier hs-type">makeLazy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PatEnv"><span class="hs-identifier hs-type">PatEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PatEnv"><span class="hs-identifier hs-type">PatEnv</span></a></span><span>
</span><span id="line-190"></span><span id="makeLazy"><span class="annot"><span class="annottext">makeLazy :: PatEnv -&gt; PatEnv
</span><a href="GHC.Tc.Gen.Pat.html#makeLazy"><span class="hs-identifier hs-var hs-var">makeLazy</span></a></span></span><span> </span><span id="local-6989586621681121951"><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121951"><span class="hs-identifier hs-var">penv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121951"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pe_lazy :: Bool
</span><a href="GHC.Tc.Gen.Pat.html#pe_lazy"><span class="hs-identifier hs-var">pe_lazy</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-191"></span><span>
</span><span id="line-192"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#inPatBind"><span class="hs-identifier hs-type">inPatBind</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PatEnv"><span class="hs-identifier hs-type">PatEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-193"></span><span id="inPatBind"><span class="annot"><span class="annottext">inPatBind :: PatEnv -&gt; Bool
</span><a href="GHC.Tc.Gen.Pat.html#inPatBind"><span class="hs-identifier hs-var hs-var">inPatBind</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PE"><span class="hs-identifier hs-type">PE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pe_ctxt :: PatEnv -&gt; PatCtxt
</span><a href="GHC.Tc.Gen.Pat.html#pe_ctxt"><span class="hs-identifier hs-var">pe_ctxt</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetPat"><span class="hs-identifier hs-type">LetPat</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-194"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#inPatBind"><span class="hs-identifier hs-var">inPatBind</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PE"><span class="hs-identifier hs-type">PE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pe_ctxt :: PatEnv -&gt; PatCtxt
</span><a href="GHC.Tc.Gen.Pat.html#pe_ctxt"><span class="hs-identifier hs-var">pe_ctxt</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LamPat"><span class="hs-identifier hs-type">LamPat</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-195"></span><span>
</span><span id="line-196"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
                Binders
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-201"></span><span>
</span><span id="line-202"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcPatBndr"><span class="hs-identifier hs-type">tcPatBndr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PatEnv"><span class="hs-identifier hs-type">PatEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpSigmaType"><span class="hs-identifier hs-type">ExpSigmaType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#HsWrapper"><span class="hs-identifier hs-type">HsWrapper</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier hs-type">TcId</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-203"></span><span class="hs-comment">-- (coi, xp) = tcPatBndr penv x pat_ty</span><span>
</span><span id="line-204"></span><span class="hs-comment">-- Then coi : pat_ty ~ typeof(xp)</span><span>
</span><span id="line-205"></span><span class="hs-comment">--</span><span>
</span><span id="line-206"></span><span id="tcPatBndr"><span class="annot"><span class="annottext">tcPatBndr :: PatEnv -&gt; Name -&gt; Scaled ExpSigmaType -&gt; TcM (HsWrapper, TyVar)
</span><a href="GHC.Tc.Gen.Pat.html#tcPatBndr"><span class="hs-identifier hs-var hs-var">tcPatBndr</span></a></span></span><span> </span><span id="local-6989586621681121948"><span class="annot"><span class="annottext">penv :: PatEnv
</span><a href="#local-6989586621681121948"><span class="hs-identifier hs-var">penv</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PE"><span class="hs-identifier hs-type">PE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pe_ctxt :: PatEnv -&gt; PatCtxt
</span><a href="GHC.Tc.Gen.Pat.html#pe_ctxt"><span class="hs-identifier hs-var">pe_ctxt</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetPat"><span class="hs-identifier hs-type">LetPat</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pc_lvl :: PatCtxt -&gt; TcLevel
</span><a href="GHC.Tc.Gen.Pat.html#pc_lvl"><span class="hs-identifier hs-var">pc_lvl</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681121947"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621681121947"><span class="hs-identifier hs-var">bind_lvl</span></a></span></span><span>
</span><span id="line-207"></span><span>                                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pc_sig_fn :: PatCtxt -&gt; Name -&gt; Maybe TyVar
</span><a href="GHC.Tc.Gen.Pat.html#pc_sig_fn"><span class="hs-identifier hs-var">pc_sig_fn</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681121946"><span class="annot"><span class="annottext">Name -&gt; Maybe TyVar
</span><a href="#local-6989586621681121946"><span class="hs-identifier hs-var">sig_fn</span></a></span></span><span>
</span><span id="line-208"></span><span>                                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pc_new :: PatCtxt -&gt; LetBndrSpec
</span><a href="GHC.Tc.Gen.Pat.html#pc_new"><span class="hs-identifier hs-var">pc_new</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681121945"><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681121945"><span class="hs-identifier hs-var">no_gen</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-209"></span><span>          </span><span id="local-6989586621681121944"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121944"><span class="hs-identifier hs-var">bndr_name</span></a></span></span><span> </span><span id="local-6989586621681121943"><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121943"><span class="hs-identifier hs-var">exp_pat_ty</span></a></span></span><span>
</span><span id="line-210"></span><span>  </span><span class="hs-comment">-- For the LetPat cases, see</span><span>
</span><span id="line-211"></span><span>  </span><span class="hs-comment">-- Note [Typechecking pattern bindings] in GHC.Tc.Gen.Bind</span><span>
</span><span id="line-212"></span><span>
</span><span id="line-213"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681121942"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121942"><span class="hs-identifier hs-var">bndr_id</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Maybe TyVar
</span><a href="#local-6989586621681121946"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121944"><span class="hs-identifier hs-var">bndr_name</span></a></span><span>   </span><span class="hs-comment">-- There is a signature</span><span>
</span><span id="line-214"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121941"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121941"><span class="hs-identifier hs-var">wrap</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">PatEnv -&gt; ExpSigmaType -&gt; TcType -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Gen.Pat.html#tc_sub_type"><span class="hs-identifier hs-var">tc_sub_type</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121948"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121943"><span class="hs-identifier hs-var">exp_pat_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyVar -&gt; TcType
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121942"><span class="hs-identifier hs-var">bndr_id</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-215"></span><span>           </span><span class="hs-comment">-- See Note [Subsumption check at pattern variables]</span><span>
</span><span id="line-216"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcPatBndr(sig)&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyVar -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121942"><span class="hs-identifier hs-var">bndr_id</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">TcType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyVar -&gt; TcType
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121942"><span class="hs-identifier hs-var">bndr_id</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121943"><span class="hs-identifier hs-var">exp_pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-217"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(HsWrapper, TyVar) -&gt; TcM (HsWrapper, TyVar)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121941"><span class="hs-identifier hs-var">wrap</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121942"><span class="hs-identifier hs-var">bndr_id</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-218"></span><span>
</span><span id="line-219"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                          </span><span class="hs-comment">-- No signature</span><span>
</span><span id="line-220"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121935"><span class="annot"><span class="annottext">TcCoercionN
</span><a href="#local-6989586621681121935"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121934"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121934"><span class="hs-identifier hs-var">bndr_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121943"><span class="hs-identifier hs-var">exp_pat_ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-221"></span><span>             </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#Check"><span class="hs-identifier hs-type">Check</span></a></span><span> </span><span id="local-6989586621681121932"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121932"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TcLevel
-&gt; TcType -&gt; IOEnv (Env TcGblEnv TcLclEnv) (TcCoercionN, TcType)
</span><a href="GHC.Tc.Utils.TcMType.html#promoteTcType"><span class="hs-identifier hs-var">promoteTcType</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621681121947"><span class="hs-identifier hs-var">bind_lvl</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121932"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-222"></span><span>             </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#Infer"><span class="hs-identifier hs-type">Infer</span></a></span><span> </span><span id="local-6989586621681121929"><span class="annot"><span class="annottext">InferResult
</span><a href="#local-6989586621681121929"><span class="hs-identifier hs-var">infer_res</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">bind_lvl</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">ir_lvl</span><span> </span><span class="hs-identifier">infer_res</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-223"></span><span>                                </span><span class="hs-comment">-- If we were under a constructor that bumped the</span><span>
</span><span id="line-224"></span><span>                                </span><span class="hs-comment">-- level, we'd be in checking mode (see tcConArg)</span><span>
</span><span id="line-225"></span><span>                                </span><span class="hs-comment">-- hence this assertion</span><span>
</span><span id="line-226"></span><span>                                </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121923"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121923"><span class="hs-identifier hs-var">bndr_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">InferResult -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#inferResultToType"><span class="hs-identifier hs-var">inferResultToType</span></a></span><span> </span><span class="annot"><span class="annottext">InferResult
</span><a href="#local-6989586621681121929"><span class="hs-identifier hs-var">infer_res</span></a></span><span>
</span><span id="line-227"></span><span>                                   </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(TcCoercionN, TcType)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (TcCoercionN, TcType)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; TcCoercionN
</span><a href="GHC.Tc.Types.Evidence.html#mkTcNomReflCo"><span class="hs-identifier hs-var">mkTcNomReflCo</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121923"><span class="hs-identifier hs-var">bndr_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121923"><span class="hs-identifier hs-var">bndr_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-228"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121920"><span class="annot"><span class="annottext">bndr_mult :: TcType
</span><a href="#local-6989586621681121920"><span class="hs-identifier hs-var hs-var">bndr_mult</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; TcType
forall a. Scaled a -&gt; TcType
</span><a href="GHC.Core.TyCo.Rep.html#scaledMult"><span class="hs-identifier hs-var">scaledMult</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121943"><span class="hs-identifier hs-var">exp_pat_ty</span></a></span><span>
</span><span id="line-229"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121918"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121918"><span class="hs-identifier hs-var">bndr_id</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LetBndrSpec -&gt; Name -&gt; TcType -&gt; TcType -&gt; TcM TyVar
</span><a href="GHC.Tc.Gen.Pat.html#newLetBndr"><span class="hs-identifier hs-var">newLetBndr</span></a></span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681121945"><span class="hs-identifier hs-var">no_gen</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121944"><span class="hs-identifier hs-var">bndr_name</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121920"><span class="hs-identifier hs-var">bndr_mult</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121934"><span class="hs-identifier hs-var">bndr_ty</span></a></span><span>
</span><span id="line-230"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcPatBndr(nosig)&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">TcLevel -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621681121947"><span class="hs-identifier hs-var">bind_lvl</span></a></span><span>
</span><span id="line-231"></span><span>                                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121943"><span class="hs-identifier hs-var">exp_pat_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121934"><span class="hs-identifier hs-var">bndr_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcCoercionN -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcCoercionN
</span><a href="#local-6989586621681121935"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-232"></span><span>                                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121918"><span class="hs-identifier hs-var">bndr_id</span></a></span><span> </span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-233"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(HsWrapper, TyVar) -&gt; TcM (HsWrapper, TyVar)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcCoercionN -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#mkWpCastN"><span class="hs-identifier hs-var">mkWpCastN</span></a></span><span> </span><span class="annot"><span class="annottext">TcCoercionN
</span><a href="#local-6989586621681121935"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121918"><span class="hs-identifier hs-var">bndr_id</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-234"></span><span>
</span><span id="line-235"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcPatBndr"><span class="hs-identifier hs-var">tcPatBndr</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681121915"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121915"><span class="hs-identifier hs-var">bndr_name</span></a></span></span><span> </span><span id="local-6989586621681121914"><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121914"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span>
</span><span id="line-236"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121913"><span class="annot"><span class="annottext">pat_mult :: TcType
</span><a href="#local-6989586621681121913"><span class="hs-identifier hs-var hs-var">pat_mult</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; TcType
forall a. Scaled a -&gt; TcType
</span><a href="GHC.Core.TyCo.Rep.html#scaledMult"><span class="hs-identifier hs-var">scaledMult</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121914"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-237"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121912"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121912"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#expTypeToType"><span class="hs-identifier hs-var">expTypeToType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121914"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-238"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcPatBndr(not let)&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121915"><span class="hs-identifier hs-var">bndr_name</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">TcType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121912"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-239"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(HsWrapper, TyVar) -&gt; TcM (HsWrapper, TyVar)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#idHsWrapper"><span class="hs-identifier hs-var">idHsWrapper</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcType -&gt; TcType -&gt; TyVar
</span><a href="GHC.Types.Id.html#mkLocalIdOrCoVar"><span class="hs-identifier hs-var">mkLocalIdOrCoVar</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121915"><span class="hs-identifier hs-var">bndr_name</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121913"><span class="hs-identifier hs-var">pat_mult</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121912"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-240"></span><span>               </span><span class="hs-comment">-- We should not have &quot;OrCoVar&quot; here, this is a bug (#17545)</span><span>
</span><span id="line-241"></span><span>               </span><span class="hs-comment">-- Whether or not there is a sig is irrelevant,</span><span>
</span><span id="line-242"></span><span>               </span><span class="hs-comment">-- as this is local</span><span>
</span><span id="line-243"></span><span>
</span><span id="line-244"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#newLetBndr"><span class="hs-identifier hs-type">newLetBndr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetBndrSpec"><span class="hs-identifier hs-type">LetBndrSpec</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Mult"><span class="hs-identifier hs-type">Mult</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier hs-type">TcId</span></a></span><span>
</span><span id="line-245"></span><span class="hs-comment">-- Make up a suitable Id for the pattern-binder.</span><span>
</span><span id="line-246"></span><span class="hs-comment">-- See Note [Typechecking pattern bindings], item (4) in GHC.Tc.Gen.Bind</span><span>
</span><span id="line-247"></span><span class="hs-comment">--</span><span>
</span><span id="line-248"></span><span class="hs-comment">-- In the polymorphic case when we are going to generalise</span><span>
</span><span id="line-249"></span><span class="hs-comment">--    (plan InferGen, no_gen = LetLclBndr), generate a &quot;monomorphic version&quot;</span><span>
</span><span id="line-250"></span><span class="hs-comment">--    of the Id; the original name will be bound to the polymorphic version</span><span>
</span><span id="line-251"></span><span class="hs-comment">--    by the AbsBinds</span><span>
</span><span id="line-252"></span><span class="hs-comment">-- In the monomorphic case when we are not going to generalise</span><span>
</span><span id="line-253"></span><span class="hs-comment">--    (plan NoGen, no_gen = LetGblBndr) there is no AbsBinds,</span><span>
</span><span id="line-254"></span><span class="hs-comment">--    and we use the original name directly</span><span>
</span><span id="line-255"></span><span id="newLetBndr"><span class="annot"><span class="annottext">newLetBndr :: LetBndrSpec -&gt; Name -&gt; TcType -&gt; TcType -&gt; TcM TyVar
</span><a href="GHC.Tc.Gen.Pat.html#newLetBndr"><span class="hs-identifier hs-var hs-var">newLetBndr</span></a></span></span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="GHC.Tc.Gen.Pat.html#LetLclBndr"><span class="hs-identifier hs-var">LetLclBndr</span></a></span><span> </span><span id="local-6989586621681121907"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121907"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span id="local-6989586621681121906"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121906"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621681121905"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121905"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-256"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121904"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121904"><span class="hs-identifier hs-var">mono_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM Name
</span><a href="GHC.Tc.Utils.Monad.html#cloneLocalName"><span class="hs-identifier hs-var">cloneLocalName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121907"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-257"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; TcM TyVar
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Name -&gt; TcType -&gt; TcType -&gt; TyVar
Name -&gt; TcType -&gt; TcType -&gt; TyVar
</span><a href="GHC.Types.Id.html#mkLocalId"><span class="hs-identifier hs-var">mkLocalId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121904"><span class="hs-identifier hs-var">mono_name</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121906"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121905"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-258"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#newLetBndr"><span class="hs-identifier hs-var">newLetBndr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetGblBndr"><span class="hs-identifier hs-type">LetGblBndr</span></a></span><span> </span><span id="local-6989586621681121901"><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681121901"><span class="hs-identifier hs-var">prags</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681121900"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121900"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span id="local-6989586621681121899"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121899"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621681121898"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121898"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-259"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; [LSig GhcRn] -&gt; TcM TyVar
</span><a href="GHC.Tc.Gen.Sig.html#addInlinePrags"><span class="hs-identifier hs-var">addInlinePrags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Name -&gt; TcType -&gt; TcType -&gt; TyVar
Name -&gt; TcType -&gt; TcType -&gt; TyVar
</span><a href="GHC.Types.Id.html#mkLocalId"><span class="hs-identifier hs-var">mkLocalId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121900"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121899"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121898"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcPragEnv -&gt; Name -&gt; [LSig GhcRn]
</span><a href="GHC.Tc.Gen.Sig.html#lookupPragEnv"><span class="hs-identifier hs-var">lookupPragEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681121901"><span class="hs-identifier hs-var">prags</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121900"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-260"></span><span>
</span><span id="line-261"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tc_sub_type"><span class="hs-identifier hs-type">tc_sub_type</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PatEnv"><span class="hs-identifier hs-type">PatEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpSigmaType"><span class="hs-identifier hs-type">ExpSigmaType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcSigmaType"><span class="hs-identifier hs-type">TcSigmaType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#HsWrapper"><span class="hs-identifier hs-type">HsWrapper</span></a></span><span>
</span><span id="line-262"></span><span class="hs-comment">-- tcSubTypeET with the UserTypeCtxt specialised to GenSigCtxt</span><span>
</span><span id="line-263"></span><span class="hs-comment">-- Used during typechecking patterns</span><span>
</span><span id="line-264"></span><span id="tc_sub_type"><span class="annot"><span class="annottext">tc_sub_type :: PatEnv -&gt; ExpSigmaType -&gt; TcType -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Gen.Pat.html#tc_sub_type"><span class="hs-identifier hs-var hs-var">tc_sub_type</span></a></span></span><span> </span><span id="local-6989586621681121897"><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121897"><span class="hs-identifier hs-var">penv</span></a></span></span><span> </span><span id="local-6989586621681121896"><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681121896"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span id="local-6989586621681121895"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121895"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtOrigin -&gt; UserTypeCtxt -&gt; ExpSigmaType -&gt; TcType -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Utils.Unify.html#tcSubTypePat"><span class="hs-identifier hs-var">tcSubTypePat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PatEnv -&gt; CtOrigin
</span><a href="GHC.Tc.Gen.Pat.html#pe_orig"><span class="hs-identifier hs-var hs-var">pe_orig</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121897"><span class="hs-identifier hs-var">penv</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UserTypeCtxt
</span><a href="GHC.Tc.Types.Origin.html#GenSigCtxt"><span class="hs-identifier hs-var">GenSigCtxt</span></a></span><span> </span><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681121896"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121895"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-265"></span><span>
</span><span id="line-266"></span><span class="hs-comment">{- Note [Subsumption check at pattern variables]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When we come across a variable with a type signature, we need to do a
subsumption, not equality, check against the context type.  e.g.

    data T = MkT (forall a. a-&gt;a)
      f :: forall b. [b]-&gt;[b]
      MkT f = blah

Since 'blah' returns a value of type T, its payload is a polymorphic
function of type (forall a. a-&gt;a).  And that's enough to bind the
less-polymorphic function 'f', but we need some impedance matching
to witness the instantiation.


************************************************************************
*                                                                      *
                The main worker functions
*                                                                      *
************************************************************************

Note [Nesting]
~~~~~~~~~~~~~~
tcPat takes a &quot;thing inside&quot; over which the pattern scopes.  This is partly
so that tcPat can extend the environment for the thing_inside, but also
so that constraints arising in the thing_inside can be discharged by the
pattern.

This does not work so well for the ErrCtxt carried by the monad: we don't
want the error-context for the pattern to scope over the RHS.
Hence the getErrCtxt/setErrCtxt stuff in tcMultiple
-}</span><span>
</span><span id="line-298"></span><span>
</span><span id="line-299"></span><span class="hs-comment">--------------------</span><span>
</span><span id="line-300"></span><span>
</span><span id="line-301"></span><span class="hs-keyword">type</span><span> </span><span id="Checker"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#Checker"><span class="hs-identifier hs-var">Checker</span></a></span></span><span> </span><span id="local-6989586621681121892"><span class="annot"><a href="#local-6989586621681121892"><span class="hs-identifier hs-type">inp</span></a></span></span><span> </span><span id="local-6989586621681121891"><span class="annot"><a href="#local-6989586621681121891"><span class="hs-identifier hs-type">out</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621681121890"><span class="annot"><a href="#local-6989586621681121890"><span class="hs-identifier hs-type">r</span></a></span></span><span class="hs-operator">.</span><span>
</span><span id="line-302"></span><span>                          </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PatEnv"><span class="hs-identifier hs-type">PatEnv</span></a></span><span>
</span><span id="line-303"></span><span>                       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681121892"><span class="hs-identifier hs-type">inp</span></a></span><span>
</span><span id="line-304"></span><span>                       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681121890"><span class="hs-identifier hs-type">r</span></a></span><span>      </span><span class="hs-comment">-- Thing inside</span><span>
</span><span id="line-305"></span><span>                       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="#local-6989586621681121891"><span class="hs-identifier hs-type">out</span></a></span><span>
</span><span id="line-306"></span><span>                              </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681121890"><span class="hs-identifier hs-type">r</span></a></span><span>    </span><span class="hs-comment">-- Result of thing inside</span><span>
</span><span id="line-307"></span><span>                              </span><span class="hs-special">)</span><span>
</span><span id="line-308"></span><span>
</span><span id="line-309"></span><span id="local-6989586621681122312"><span id="local-6989586621681122313"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcMultiple"><span class="hs-identifier hs-type">tcMultiple</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#Checker"><span class="hs-identifier hs-type">Checker</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681122313"><span class="hs-identifier hs-type">inp</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681122312"><span class="hs-identifier hs-type">out</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#Checker"><span class="hs-identifier hs-type">Checker</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681122313"><span class="hs-identifier hs-type">inp</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681122312"><span class="hs-identifier hs-type">out</span></a></span><span class="hs-special">]</span></span></span><span>
</span><span id="line-310"></span><span id="tcMultiple"><span class="annot"><span class="annottext">tcMultiple :: forall inp out. Checker inp out -&gt; Checker [inp] [out]
</span><a href="GHC.Tc.Gen.Pat.html#tcMultiple"><span class="hs-identifier hs-var hs-var">tcMultiple</span></a></span></span><span> </span><span id="local-6989586621681121883"><span class="annot"><span class="annottext">Checker inp out
</span><a href="#local-6989586621681121883"><span class="hs-identifier hs-var">tc_pat</span></a></span></span><span> </span><span id="local-6989586621681121882"><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121882"><span class="hs-identifier hs-var">penv</span></a></span></span><span> </span><span id="local-6989586621681121881"><span class="annot"><span class="annottext">[inp]
</span><a href="#local-6989586621681121881"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621681121880"><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121880"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-311"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121879"><span class="annot"><span class="annottext">[ErrCtxt]
</span><a href="#local-6989586621681121879"><span class="hs-identifier hs-var">err_ctxt</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM [ErrCtxt]
</span><a href="GHC.Tc.Utils.Monad.html#getErrCtxt"><span class="hs-identifier hs-var">getErrCtxt</span></a></span><span>
</span><span id="line-312"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121877"><span class="annot"><span class="annottext">loop :: PatEnv -&gt; [inp] -&gt; TcM ([out], r)
</span><a href="#local-6989586621681121877"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-313"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121876"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121876"><span class="hs-identifier hs-var">res</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121880"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-314"></span><span>                     </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">([out], r) -&gt; TcM ([out], r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121876"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-315"></span><span>
</span><span id="line-316"></span><span>              </span><span class="annot"><a href="#local-6989586621681121877"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span id="local-6989586621681121875"><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121875"><span class="hs-identifier hs-var">penv</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121874"><span class="annot"><span class="annottext">inp
</span><a href="#local-6989586621681121874"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681121873"><span class="annot"><span class="annottext">[inp]
</span><a href="#local-6989586621681121873"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-317"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121872"><span class="annot"><span class="annottext">out
</span><a href="#local-6989586621681121872"><span class="hs-identifier hs-var">p'</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121871"><span class="annot"><span class="annottext">[out]
</span><a href="#local-6989586621681121871"><span class="hs-identifier hs-var">ps'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121870"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121870"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-318"></span><span>                                </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">PatEnv -&gt; inp -&gt; TcM ([out], r) -&gt; TcM (out, ([out], r))
Checker inp out
</span><a href="#local-6989586621681121883"><span class="hs-identifier hs-var">tc_pat</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121875"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">inp
</span><a href="#local-6989586621681121874"><span class="hs-identifier hs-var">arg</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM ([out], r) -&gt; TcM (out, ([out], r)))
-&gt; TcM ([out], r) -&gt; TcM (out, ([out], r))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-319"></span><span>                                   </span><span class="annot"><span class="annottext">[ErrCtxt] -&gt; TcM ([out], r) -&gt; TcM ([out], r)
forall a. [ErrCtxt] -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#setErrCtxt"><span class="hs-identifier hs-var">setErrCtxt</span></a></span><span> </span><span class="annot"><span class="annottext">[ErrCtxt]
</span><a href="#local-6989586621681121879"><span class="hs-identifier hs-var">err_ctxt</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM ([out], r) -&gt; TcM ([out], r))
-&gt; TcM ([out], r) -&gt; TcM ([out], r)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-320"></span><span>                                   </span><span class="annot"><span class="annottext">PatEnv -&gt; [inp] -&gt; TcM ([out], r)
</span><a href="#local-6989586621681121877"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121875"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">[inp]
</span><a href="#local-6989586621681121873"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-321"></span><span>                </span><span class="hs-comment">-- setErrCtxt: restore context before doing the next pattern</span><span>
</span><span id="line-322"></span><span>                </span><span class="hs-comment">-- See note [Nesting] above</span><span>
</span><span id="line-323"></span><span>
</span><span id="line-324"></span><span>                     </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">([out], r) -&gt; TcM ([out], r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">out
</span><a href="#local-6989586621681121872"><span class="hs-identifier hs-var">p'</span></a></span><span class="annot"><span class="annottext">out -&gt; [out] -&gt; [out]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[out]
</span><a href="#local-6989586621681121871"><span class="hs-identifier hs-var">ps'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121870"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-325"></span><span>
</span><span id="line-326"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">PatEnv -&gt; [inp] -&gt; TcM ([out], r)
</span><a href="#local-6989586621681121877"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121882"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">[inp]
</span><a href="#local-6989586621681121881"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-327"></span><span>
</span><span id="line-328"></span><span class="hs-comment">--------------------</span><span>
</span><span id="line-329"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tc_lpat"><span class="hs-identifier hs-type">tc_lpat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpSigmaType"><span class="hs-identifier hs-type">ExpSigmaType</span></a></span><span>
</span><span id="line-330"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#Checker"><span class="hs-identifier hs-type">Checker</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-331"></span><span id="tc_lpat"><span class="annot"><span class="annottext">tc_lpat :: Scaled ExpSigmaType -&gt; Checker (LPat GhcRn) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpat"><span class="hs-identifier hs-var hs-var">tc_lpat</span></a></span></span><span> </span><span id="local-6989586621681121866"><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121866"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span id="local-6989586621681121865"><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121865"><span class="hs-identifier hs-var">penv</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681121863"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121863"><span class="hs-identifier hs-var">span</span></a></span></span><span> </span><span id="local-6989586621681121862"><span class="annot"><span class="annottext">Pat GhcRn
</span><a href="#local-6989586621681121862"><span class="hs-identifier hs-var">pat</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681121861"><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121861"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-332"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; TcRn (Located (Pat GhcTc), r) -&gt; TcRn (Located (Pat GhcTc), r)
forall a. SrcSpan -&gt; TcRn a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#setSrcSpan"><span class="hs-identifier hs-var">setSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121863"><span class="hs-identifier hs-var">span</span></a></span><span> </span><span class="annot"><span class="annottext">(TcRn (Located (Pat GhcTc), r) -&gt; TcRn (Located (Pat GhcTc), r))
-&gt; TcRn (Located (Pat GhcTc), r) -&gt; TcRn (Located (Pat GhcTc), r)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-333"></span><span>    </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121859"><span class="annot"><span class="annottext">Pat GhcTc
</span><a href="#local-6989586621681121859"><span class="hs-identifier hs-var">pat'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121858"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121858"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Pat GhcRn
-&gt; (TcM r -&gt; TcM (Pat GhcTc, r)) -&gt; TcM r -&gt; TcM (Pat GhcTc, r)
forall a b. Pat GhcRn -&gt; (TcM a -&gt; TcM b) -&gt; TcM a -&gt; TcM b
</span><a href="GHC.Tc.Gen.Pat.html#maybeWrapPatCtxt"><span class="hs-identifier hs-var">maybeWrapPatCtxt</span></a></span><span> </span><span class="annot"><span class="annottext">Pat GhcRn
</span><a href="#local-6989586621681121862"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; Checker (Pat GhcRn) (Pat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_pat"><span class="hs-identifier hs-var">tc_pat</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121866"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121865"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">Pat GhcRn
</span><a href="#local-6989586621681121862"><span class="hs-identifier hs-var">pat</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-334"></span><span>                                          </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121861"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-335"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Located (Pat GhcTc), r) -&gt; TcRn (Located (Pat GhcTc), r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; Pat GhcTc -&gt; Located (Pat GhcTc)
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121863"><span class="hs-identifier hs-var">span</span></a></span><span> </span><span class="annot"><span class="annottext">Pat GhcTc
</span><a href="#local-6989586621681121859"><span class="hs-identifier hs-var">pat'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121858"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-336"></span><span>
</span><span id="line-337"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tc_lpats"><span class="hs-identifier hs-type">tc_lpats</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpSigmaType"><span class="hs-identifier hs-type">ExpSigmaType</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-338"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#Checker"><span class="hs-identifier hs-type">Checker</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-339"></span><span id="tc_lpats"><span class="annot"><span class="annottext">tc_lpats :: [Scaled ExpSigmaType] -&gt; Checker [LPat GhcRn] [LPat GhcTc]
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpats"><span class="hs-identifier hs-var hs-var">tc_lpats</span></a></span></span><span> </span><span id="local-6989586621681121838"><span class="annot"><span class="annottext">[Scaled ExpSigmaType]
</span><a href="#local-6989586621681121838"><span class="hs-identifier hs-var">tys</span></a></span></span><span> </span><span id="local-6989586621681121837"><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121837"><span class="hs-identifier hs-var">penv</span></a></span></span><span> </span><span id="local-6989586621681121836"><span class="annot"><span class="annottext">[LPat GhcRn]
</span><a href="#local-6989586621681121836"><span class="hs-identifier hs-var">pats</span></a></span></span><span>
</span><span id="line-340"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">equalLength</span><span> </span><span class="hs-identifier">pats</span><span> </span><span class="hs-identifier">tys</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">pats</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">tys</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-341"></span><span>    </span><span class="annot"><span class="annottext">Checker
  (GenLocated SrcSpan (Pat GhcRn), Scaled ExpSigmaType)
  (Located (Pat GhcTc))
-&gt; Checker
     [(GenLocated SrcSpan (Pat GhcRn), Scaled ExpSigmaType)]
     [Located (Pat GhcTc)]
forall inp out. Checker inp out -&gt; Checker [inp] [out]
</span><a href="GHC.Tc.Gen.Pat.html#tcMultiple"><span class="hs-identifier hs-var">tcMultiple</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621681121833"><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121833"><span class="hs-identifier hs-var">penv'</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121832"><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat GhcRn)
</span><a href="#local-6989586621681121832"><span class="hs-identifier hs-var">p</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681121831"><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121831"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; Checker (LPat GhcRn) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpat"><span class="hs-identifier hs-var">tc_lpat</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121831"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121833"><span class="hs-identifier hs-var">penv'</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat GhcRn)
LPat GhcRn
</span><a href="#local-6989586621681121832"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-342"></span><span>               </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121837"><span class="hs-identifier hs-var">penv</span></a></span><span>
</span><span id="line-343"></span><span>               </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
-&gt; [GenLocated SrcSpan (Pat GhcRn)]
-&gt; [Scaled ExpSigmaType]
-&gt; [(GenLocated SrcSpan (Pat GhcRn), Scaled ExpSigmaType)]
forall a b. String -&gt; [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="GHC.Utils.Misc.html#zipEqual"><span class="hs-identifier hs-var">zipEqual</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tc_lpats&quot;</span></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan (Pat GhcRn)]
[LPat GhcRn]
</span><a href="#local-6989586621681121836"><span class="hs-identifier hs-var">pats</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled ExpSigmaType]
</span><a href="#local-6989586621681121838"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-344"></span><span>
</span><span id="line-345"></span><span class="hs-comment">--------------------</span><span>
</span><span id="line-346"></span><span class="hs-comment">-- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify.</span><span>
</span><span id="line-347"></span><span id="local-6989586621681122282"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#checkManyPattern"><span class="hs-identifier hs-type">checkManyPattern</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681122282"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#HsWrapper"><span class="hs-identifier hs-type">HsWrapper</span></a></span></span><span>
</span><span id="line-348"></span><span id="checkManyPattern"><span class="annot"><span class="annottext">checkManyPattern :: forall a. Scaled a -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Gen.Pat.html#checkManyPattern"><span class="hs-identifier hs-var hs-var">checkManyPattern</span></a></span></span><span> </span><span id="local-6989586621681121828"><span class="annot"><span class="annottext">Scaled a
</span><a href="#local-6989586621681121828"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtOrigin -&gt; TcType -&gt; TcType -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Utils.Unify.html#tcSubMult"><span class="hs-identifier hs-var">tcSubMult</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="GHC.Tc.Types.Origin.html#NonLinearPatternOrigin"><span class="hs-identifier hs-var">NonLinearPatternOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="GHC.Core.Type.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled a -&gt; TcType
forall a. Scaled a -&gt; TcType
</span><a href="GHC.Core.TyCo.Rep.html#scaledMult"><span class="hs-identifier hs-var">scaledMult</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled a
</span><a href="#local-6989586621681121828"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-349"></span><span>
</span><span id="line-350"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tc_pat"><span class="hs-identifier hs-type">tc_pat</span></a></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpSigmaType"><span class="hs-identifier hs-type">ExpSigmaType</span></a></span><span>
</span><span id="line-351"></span><span>        </span><span class="hs-comment">-- ^ Fully refined result type</span><span>
</span><span id="line-352"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#Checker"><span class="hs-identifier hs-type">Checker</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#Pat"><span class="hs-identifier hs-type">Pat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#Pat"><span class="hs-identifier hs-type">Pat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-353"></span><span>        </span><span class="hs-comment">-- ^ Translated pattern</span><span>
</span><span id="line-354"></span><span>
</span><span id="line-355"></span><span id="tc_pat"><span class="annot"><span class="annottext">tc_pat :: Scaled ExpSigmaType -&gt; Checker (Pat GhcRn) (Pat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_pat"><span class="hs-identifier hs-var hs-var">tc_pat</span></a></span></span><span> </span><span id="local-6989586621681121722"><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span id="local-6989586621681121721"><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span></span><span> </span><span id="local-6989586621681121720"><span class="annot"><span class="annottext">Pat GhcRn
</span><a href="#local-6989586621681121720"><span class="hs-identifier hs-var">ps_pat</span></a></span></span><span> </span><span id="local-6989586621681121719"><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Pat GhcRn
</span><a href="#local-6989586621681121720"><span class="hs-identifier hs-var">ps_pat</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-356"></span><span>
</span><span id="line-357"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#VarPat"><span class="hs-identifier hs-type">VarPat</span></a></span><span> </span><span id="local-6989586621681121717"><span class="annot"><span class="annottext">XVarPat GhcRn
</span><a href="#local-6989586621681121717"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681121716"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121716"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681121715"><span class="annot"><span class="annottext">IdP GhcRn
</span><a href="#local-6989586621681121715"><span class="hs-identifier hs-var">name</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-358"></span><span>        </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121714"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121714"><span class="hs-identifier hs-var">wrap</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121713"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121713"><span class="hs-identifier hs-var">id</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">PatEnv -&gt; Name -&gt; Scaled ExpSigmaType -&gt; TcM (HsWrapper, TyVar)
</span><a href="GHC.Tc.Gen.Pat.html#tcPatBndr"><span class="hs-identifier hs-var">tcPatBndr</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP GhcRn
</span><a href="#local-6989586621681121715"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-359"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121712"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121712"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121711"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121711"><span class="hs-identifier hs-var">mult_wrap</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcType -&gt; TcM r -&gt; TcM (r, HsWrapper)
forall a. Name -&gt; TcType -&gt; TcM a -&gt; TcM (a, HsWrapper)
</span><a href="GHC.Tc.Utils.Env.html#tcCheckUsage"><span class="hs-identifier hs-var">tcCheckUsage</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP GhcRn
</span><a href="#local-6989586621681121715"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; TcType
forall a. Scaled a -&gt; TcType
</span><a href="GHC.Core.TyCo.Rep.html#scaledMult"><span class="hs-identifier hs-var">scaledMult</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcM r -&gt; TcM (r, HsWrapper)) -&gt; TcM r -&gt; TcM (r, HsWrapper)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-360"></span><span>                              </span><span class="annot"><span class="annottext">Name -&gt; TyVar -&gt; TcM r -&gt; TcM r
forall a. Name -&gt; TyVar -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Env.html#tcExtendIdEnv1"><span class="hs-identifier hs-var">tcExtendIdEnv1</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP GhcRn
</span><a href="#local-6989586621681121715"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121713"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-361"></span><span>            </span><span class="hs-comment">-- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify.</span><span>
</span><span id="line-362"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121708"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121708"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#readExpType"><span class="hs-identifier hs-var">readExpType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-363"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Pat GhcTc, r) -&gt; TcM (Pat GhcTc, r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper -&gt; Pat GhcTc -&gt; TcType -&gt; Pat GhcTc
</span><a href="GHC.Hs.Utils.html#mkHsWrapPat"><span class="hs-identifier hs-var">mkHsWrapPat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121714"><span class="hs-identifier hs-var">wrap</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper -&gt; HsWrapper -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121711"><span class="hs-identifier hs-var">mult_wrap</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XVarPat GhcTc -&gt; Located (IdP GhcTc) -&gt; Pat GhcTc
forall p. XVarPat p -&gt; Located (IdP p) -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#VarPat"><span class="hs-identifier hs-var">VarPat</span></a></span><span> </span><span class="annot"><span class="annottext">XVarPat GhcRn
XVarPat GhcTc
</span><a href="#local-6989586621681121717"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; TyVar -&gt; GenLocated SrcSpan TyVar
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121716"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121713"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121708"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121712"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-364"></span><span>
</span><span id="line-365"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#ParPat"><span class="hs-identifier hs-type">ParPat</span></a></span><span> </span><span id="local-6989586621681121703"><span class="annot"><span class="annottext">XParPat GhcRn
</span><a href="#local-6989586621681121703"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681121702"><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121702"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-366"></span><span>        </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121701"><span class="annot"><span class="annottext">Located (Pat GhcTc)
</span><a href="#local-6989586621681121701"><span class="hs-identifier hs-var">pat'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121700"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121700"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; Checker (LPat GhcRn) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpat"><span class="hs-identifier hs-var">tc_lpat</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121702"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-367"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Pat GhcTc, r) -&gt; TcM (Pat GhcTc, r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XParPat GhcTc -&gt; LPat GhcTc -&gt; Pat GhcTc
forall p. XParPat p -&gt; LPat p -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#ParPat"><span class="hs-identifier hs-var">ParPat</span></a></span><span> </span><span class="annot"><span class="annottext">XParPat GhcRn
XParPat GhcTc
</span><a href="#local-6989586621681121703"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcTc)
LPat GhcTc
</span><a href="#local-6989586621681121701"><span class="hs-identifier hs-var">pat'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121700"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-368"></span><span>
</span><span id="line-369"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#BangPat"><span class="hs-identifier hs-type">BangPat</span></a></span><span> </span><span id="local-6989586621681121698"><span class="annot"><span class="annottext">XBangPat GhcRn
</span><a href="#local-6989586621681121698"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681121697"><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121697"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-370"></span><span>        </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121696"><span class="annot"><span class="annottext">Located (Pat GhcTc)
</span><a href="#local-6989586621681121696"><span class="hs-identifier hs-var">pat'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121695"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121695"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; Checker (LPat GhcRn) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpat"><span class="hs-identifier hs-var">tc_lpat</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121697"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-371"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Pat GhcTc, r) -&gt; TcM (Pat GhcTc, r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XBangPat GhcTc -&gt; LPat GhcTc -&gt; Pat GhcTc
forall p. XBangPat p -&gt; LPat p -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#BangPat"><span class="hs-identifier hs-var">BangPat</span></a></span><span> </span><span class="annot"><span class="annottext">XBangPat GhcRn
XBangPat GhcTc
</span><a href="#local-6989586621681121698"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcTc)
LPat GhcTc
</span><a href="#local-6989586621681121696"><span class="hs-identifier hs-var">pat'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121695"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-372"></span><span>
</span><span id="line-373"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#LazyPat"><span class="hs-identifier hs-type">LazyPat</span></a></span><span> </span><span id="local-6989586621681121693"><span class="annot"><span class="annottext">XLazyPat GhcRn
</span><a href="#local-6989586621681121693"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681121692"><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121692"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-374"></span><span>        </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121691"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121691"><span class="hs-identifier hs-var">mult_wrap</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; TcM HsWrapper
forall a. Scaled a -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Gen.Pat.html#checkManyPattern"><span class="hs-identifier hs-var">checkManyPattern</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-375"></span><span>            </span><span class="hs-comment">-- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify.</span><span>
</span><span id="line-376"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121690"><span class="annot"><span class="annottext">Located (Pat GhcTc)
</span><a href="#local-6989586621681121690"><span class="hs-identifier hs-var">pat'</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121689"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121689"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121688"><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621681121688"><span class="hs-identifier hs-var">pat_ct</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-377"></span><span>                </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; Checker (LPat GhcRn) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpat"><span class="hs-identifier hs-var">tc_lpat</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PatEnv -&gt; PatEnv
</span><a href="GHC.Tc.Gen.Pat.html#makeLazy"><span class="hs-identifier hs-var">makeLazy</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121692"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM (r, WantedConstraints)
 -&gt; TcM (LPat GhcTc, (r, WantedConstraints)))
-&gt; TcM (r, WantedConstraints)
-&gt; TcM (LPat GhcTc, (r, WantedConstraints))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-378"></span><span>                   </span><span class="annot"><span class="annottext">TcM r -&gt; TcM (r, WantedConstraints)
forall a. TcM a -&gt; TcM (a, WantedConstraints)
</span><a href="GHC.Tc.Utils.Monad.html#captureConstraints"><span class="hs-identifier hs-var">captureConstraints</span></a></span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-379"></span><span>                </span><span class="hs-comment">-- Ignore refined penv', revert to penv</span><span>
</span><span id="line-380"></span><span>
</span><span id="line-381"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">WantedConstraints -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#emitConstraints"><span class="hs-identifier hs-var">emitConstraints</span></a></span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621681121688"><span class="hs-identifier hs-var">pat_ct</span></a></span><span>
</span><span id="line-382"></span><span>        </span><span class="hs-comment">-- captureConstraints/extendConstraints:</span><span>
</span><span id="line-383"></span><span>        </span><span class="hs-comment">--   see Note [Hopping the LIE in lazy patterns]</span><span>
</span><span id="line-384"></span><span>
</span><span id="line-385"></span><span>        </span><span class="hs-comment">-- Check that the expected pattern type is itself lifted</span><span>
</span><span id="line-386"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121685"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121685"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#readExpType"><span class="hs-identifier hs-var">readExpType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-387"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TcCoercionN
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe (HsExpr GhcRn) -&gt; TcType -&gt; TcType -&gt; TcM TcCoercionN
</span><a href="GHC.Tc.Utils.Unify.html#unifyType"><span class="hs-identifier hs-var">unifyType</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (HsExpr GhcRn)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; TcType -&gt; TcType
TcType -&gt; TcType
</span><a href="GHC.Core.Type.html#tcTypeKind"><span class="hs-identifier hs-var">tcTypeKind</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121685"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="GHC.Builtin.Types.html#liftedTypeKind"><span class="hs-identifier hs-var">liftedTypeKind</span></a></span><span>
</span><span id="line-388"></span><span>
</span><span id="line-389"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Pat GhcTc, r) -&gt; TcM (Pat GhcTc, r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper -&gt; Pat GhcTc -&gt; TcType -&gt; Pat GhcTc
</span><a href="GHC.Hs.Utils.html#mkHsWrapPat"><span class="hs-identifier hs-var">mkHsWrapPat</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121691"><span class="hs-identifier hs-var">mult_wrap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XLazyPat GhcTc -&gt; LPat GhcTc -&gt; Pat GhcTc
forall p. XLazyPat p -&gt; LPat p -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#LazyPat"><span class="hs-identifier hs-var">LazyPat</span></a></span><span> </span><span class="annot"><span class="annottext">XLazyPat GhcRn
XLazyPat GhcTc
</span><a href="#local-6989586621681121693"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcTc)
LPat GhcTc
</span><a href="#local-6989586621681121690"><span class="hs-identifier hs-var">pat'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121685"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121689"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-390"></span><span>
</span><span id="line-391"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#WildPat"><span class="hs-identifier hs-type">WildPat</span></a></span><span> </span><span class="annot"><span class="annottext">XWildPat GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-392"></span><span>        </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121680"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121680"><span class="hs-identifier hs-var">mult_wrap</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; TcM HsWrapper
forall a. Scaled a -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Gen.Pat.html#checkManyPattern"><span class="hs-identifier hs-var">checkManyPattern</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-393"></span><span>            </span><span class="hs-comment">-- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify.</span><span>
</span><span id="line-394"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121679"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121679"><span class="hs-identifier hs-var">res</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-395"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121678"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121678"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#expTypeToType"><span class="hs-identifier hs-var">expTypeToType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-396"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Pat GhcTc, r) -&gt; TcM (Pat GhcTc, r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper -&gt; Pat GhcTc -&gt; TcType -&gt; Pat GhcTc
</span><a href="GHC.Hs.Utils.html#mkHsWrapPat"><span class="hs-identifier hs-var">mkHsWrapPat</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121680"><span class="hs-identifier hs-var">mult_wrap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XWildPat GhcTc -&gt; Pat GhcTc
forall p. XWildPat p -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#WildPat"><span class="hs-identifier hs-var">WildPat</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
XWildPat GhcTc
</span><a href="#local-6989586621681121678"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121678"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121679"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-397"></span><span>
</span><span id="line-398"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#AsPat"><span class="hs-identifier hs-type">AsPat</span></a></span><span> </span><span id="local-6989586621681121676"><span class="annot"><span class="annottext">XAsPat GhcRn
</span><a href="#local-6989586621681121676"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681121675"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121675"><span class="hs-identifier hs-var">nm_loc</span></a></span></span><span> </span><span id="local-6989586621681121674"><span class="annot"><span class="annottext">IdP GhcRn
</span><a href="#local-6989586621681121674"><span class="hs-identifier hs-var">name</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681121673"><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121673"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-399"></span><span>        </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121672"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121672"><span class="hs-identifier hs-var">mult_wrap</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; TcM HsWrapper
forall a. Scaled a -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Gen.Pat.html#checkManyPattern"><span class="hs-identifier hs-var">checkManyPattern</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-400"></span><span>            </span><span class="hs-comment">-- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify.</span><span>
</span><span id="line-401"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121671"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121671"><span class="hs-identifier hs-var">wrap</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121670"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121670"><span class="hs-identifier hs-var">bndr_id</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; TcM (HsWrapper, TyVar) -&gt; TcM (HsWrapper, TyVar)
forall a. SrcSpan -&gt; TcRn a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#setSrcSpan"><span class="hs-identifier hs-var">setSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121675"><span class="hs-identifier hs-var">nm_loc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PatEnv -&gt; Name -&gt; Scaled ExpSigmaType -&gt; TcM (HsWrapper, TyVar)
</span><a href="GHC.Tc.Gen.Pat.html#tcPatBndr"><span class="hs-identifier hs-var">tcPatBndr</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP GhcRn
</span><a href="#local-6989586621681121674"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-402"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121669"><span class="annot"><span class="annottext">Located (Pat GhcTc)
</span><a href="#local-6989586621681121669"><span class="hs-identifier hs-var">pat'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121668"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121668"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name
-&gt; TyVar
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r)
forall a. Name -&gt; TyVar -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Env.html#tcExtendIdEnv1"><span class="hs-identifier hs-var">tcExtendIdEnv1</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP GhcRn
</span><a href="#local-6989586621681121674"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121670"><span class="hs-identifier hs-var">bndr_id</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r)
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-403"></span><span>                         </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; Checker (LPat GhcRn) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpat"><span class="hs-identifier hs-var">tc_lpat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType -&gt; Scaled ExpSigmaType
forall a b. Scaled a -&gt; b -&gt; Scaled b
</span><a href="GHC.Core.Type.html#scaledSet"><span class="hs-operator hs-var">`scaledSet`</span></a></span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="annot"><span class="annottext">(TcType -&gt; ExpSigmaType) -&gt; TcType -&gt; ExpSigmaType
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; TcType
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121670"><span class="hs-identifier hs-var">bndr_id</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-404"></span><span>                                 </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121673"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-405"></span><span>            </span><span class="hs-comment">-- NB: if we do inference on:</span><span>
</span><span id="line-406"></span><span>            </span><span class="hs-comment">--          \ (y@(x::forall a. a-&gt;a)) = e</span><span>
</span><span id="line-407"></span><span>            </span><span class="hs-comment">-- we'll fail.  The as-pattern infers a monotype for 'y', which then</span><span>
</span><span id="line-408"></span><span>            </span><span class="hs-comment">-- fails to unify with the polymorphic type for 'x'.  This could</span><span>
</span><span id="line-409"></span><span>            </span><span class="hs-comment">-- perhaps be fixed, but only with a bit more work.</span><span>
</span><span id="line-410"></span><span>            </span><span class="hs-comment">--</span><span>
</span><span id="line-411"></span><span>            </span><span class="hs-comment">-- If you fix it, don't forget the bindInstsOfPatIds!</span><span>
</span><span id="line-412"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121666"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121666"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#readExpType"><span class="hs-identifier hs-var">readExpType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-413"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Pat GhcTc, r) -&gt; TcM (Pat GhcTc, r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper -&gt; Pat GhcTc -&gt; TcType -&gt; Pat GhcTc
</span><a href="GHC.Hs.Utils.html#mkHsWrapPat"><span class="hs-identifier hs-var">mkHsWrapPat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121671"><span class="hs-identifier hs-var">wrap</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper -&gt; HsWrapper -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121672"><span class="hs-identifier hs-var">mult_wrap</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XAsPat GhcTc -&gt; Located (IdP GhcTc) -&gt; LPat GhcTc -&gt; Pat GhcTc
forall p. XAsPat p -&gt; Located (IdP p) -&gt; LPat p -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#AsPat"><span class="hs-identifier hs-var">AsPat</span></a></span><span> </span><span class="annot"><span class="annottext">XAsPat GhcRn
XAsPat GhcTc
</span><a href="#local-6989586621681121676"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; TyVar -&gt; GenLocated SrcSpan TyVar
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121675"><span class="hs-identifier hs-var">nm_loc</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121670"><span class="hs-identifier hs-var">bndr_id</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcTc)
LPat GhcTc
</span><a href="#local-6989586621681121669"><span class="hs-identifier hs-var">pat'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121666"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121668"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-414"></span><span>
</span><span id="line-415"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#ViewPat"><span class="hs-identifier hs-type">ViewPat</span></a></span><span> </span><span class="annot"><span class="annottext">XViewPat GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681121664"><span class="annot"><span class="annottext">LHsExpr GhcRn
</span><a href="#local-6989586621681121664"><span class="hs-identifier hs-var">expr</span></a></span></span><span> </span><span id="local-6989586621681121663"><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121663"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-416"></span><span>        </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121662"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121662"><span class="hs-identifier hs-var">mult_wrap</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; TcM HsWrapper
forall a. Scaled a -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Gen.Pat.html#checkManyPattern"><span class="hs-identifier hs-var">checkManyPattern</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-417"></span><span>         </span><span class="hs-comment">-- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify.</span><span>
</span><span id="line-418"></span><span>         </span><span class="hs-comment">--</span><span>
</span><span id="line-419"></span><span>         </span><span class="hs-comment">-- It should be possible to have view patterns at linear (or otherwise</span><span>
</span><span id="line-420"></span><span>         </span><span class="hs-comment">-- non-Many) multiplicity. But it is not clear at the moment what</span><span>
</span><span id="line-421"></span><span>         </span><span class="hs-comment">-- restriction need to be put in place, if any, for linear view</span><span>
</span><span id="line-422"></span><span>         </span><span class="hs-comment">-- patterns to desugar to type-correct Core.</span><span>
</span><span id="line-423"></span><span>
</span><span id="line-424"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121661"><span class="annot"><span class="annottext">LHsExpr GhcTc
</span><a href="#local-6989586621681121661"><span class="hs-identifier hs-var">expr'</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681121660"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121660"><span class="hs-identifier hs-var">expr_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcRn -&gt; TcM (LHsExpr GhcTc, TcType)
</span><a href="GHC.Tc.Gen.Expr.html#tcInferRho"><span class="hs-identifier hs-var">tcInferRho</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcRn
</span><a href="#local-6989586621681121664"><span class="hs-identifier hs-var">expr</span></a></span><span>
</span><span id="line-425"></span><span>               </span><span class="hs-comment">-- Note [View patterns and polymorphism]</span><span>
</span><span id="line-426"></span><span>
</span><span id="line-427"></span><span>         </span><span class="hs-comment">-- Expression must be a function</span><span>
</span><span id="line-428"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121659"><span class="annot"><span class="annottext">expr_orig :: CtOrigin
</span><a href="#local-6989586621681121659"><span class="hs-identifier hs-var hs-var">expr_orig</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcRn -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Origin.html#lexprCtOrigin"><span class="hs-identifier hs-var">lexprCtOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcRn
</span><a href="#local-6989586621681121664"><span class="hs-identifier hs-var">expr</span></a></span><span>
</span><span id="line-429"></span><span>              </span><span id="local-6989586621681121657"><span class="annot"><span class="annottext">herald :: SDoc
</span><a href="#local-6989586621681121657"><span class="hs-identifier hs-var hs-var">herald</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;A view pattern expression expects&quot;</span></span><span>
</span><span id="line-430"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121656"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121656"><span class="hs-identifier hs-var">expr_wrap1</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span id="local-6989586621681121655"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121655"><span class="hs-identifier hs-var">_mult</span></a></span></span><span> </span><span id="local-6989586621681121654"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121654"><span class="hs-identifier hs-var">inf_arg_ty</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121653"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121653"><span class="hs-identifier hs-var">inf_res_sigma</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-431"></span><span>            </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SDoc
-&gt; CtOrigin
-&gt; Maybe (HsExpr GhcRn)
-&gt; (Int, [Scaled TcType])
-&gt; TcType
-&gt; TcM (HsWrapper, Scaled TcType, TcType)
</span><a href="GHC.Tc.Utils.Unify.html#matchActualFunTySigma"><span class="hs-identifier hs-var">matchActualFunTySigma</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681121657"><span class="hs-identifier hs-var">herald</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621681121659"><span class="hs-identifier hs-var">expr_orig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsExpr GhcRn -&gt; Maybe (HsExpr GhcRn)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsExpr GhcRn -&gt; HsExpr GhcRn
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcRn
</span><a href="#local-6989586621681121664"><span class="hs-identifier hs-var">expr</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121660"><span class="hs-identifier hs-var">expr_ty</span></a></span><span>
</span><span id="line-432"></span><span>               </span><span class="hs-comment">-- See Note [View patterns and polymorphism]</span><span>
</span><span id="line-433"></span><span>               </span><span class="hs-comment">-- expr_wrap1 :: expr_ty &quot;-&gt;&quot; (inf_arg_ty -&gt; inf_res_sigma)</span><span>
</span><span id="line-434"></span><span>
</span><span id="line-435"></span><span>         </span><span class="hs-comment">-- Check that overall pattern is more polymorphic than arg type</span><span>
</span><span id="line-436"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121650"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121650"><span class="hs-identifier hs-var">expr_wrap2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">PatEnv -&gt; ExpSigmaType -&gt; TcType -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Gen.Pat.html#tc_sub_type"><span class="hs-identifier hs-var">tc_sub_type</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121654"><span class="hs-identifier hs-var">inf_arg_ty</span></a></span><span>
</span><span id="line-437"></span><span>            </span><span class="hs-comment">-- expr_wrap2 :: pat_ty &quot;-&gt;&quot; inf_arg_ty</span><span>
</span><span id="line-438"></span><span>
</span><span id="line-439"></span><span>         </span><span class="hs-comment">-- Pattern must have inf_res_sigma</span><span>
</span><span id="line-440"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121649"><span class="annot"><span class="annottext">Located (Pat GhcTc)
</span><a href="#local-6989586621681121649"><span class="hs-identifier hs-var">pat'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121648"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121648"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; Checker (LPat GhcRn) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpat"><span class="hs-identifier hs-var">tc_lpat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType -&gt; Scaled ExpSigmaType
forall a b. Scaled a -&gt; b -&gt; Scaled b
</span><a href="GHC.Core.Type.html#scaledSet"><span class="hs-operator hs-var">`scaledSet`</span></a></span><span> </span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121653"><span class="hs-identifier hs-var">inf_res_sigma</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121663"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-441"></span><span>
</span><span id="line-442"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span id="local-6989586621681121647"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121647"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621681121646"><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681121646"><span class="hs-identifier hs-var">h_pat_ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-443"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121645"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121645"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#readExpType"><span class="hs-identifier hs-var">readExpType</span></a></span><span> </span><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681121646"><span class="hs-identifier hs-var">h_pat_ty</span></a></span><span>
</span><span id="line-444"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121644"><span class="annot"><span class="annottext">expr_wrap2' :: HsWrapper
</span><a href="#local-6989586621681121644"><span class="hs-identifier hs-var hs-var">expr_wrap2'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsWrapper
-&gt; HsWrapper -&gt; Scaled TcType -&gt; TcType -&gt; SDoc -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#mkWpFun"><span class="hs-identifier hs-var">mkWpFun</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121650"><span class="hs-identifier hs-var">expr_wrap2</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#idHsWrapper"><span class="hs-identifier hs-var">idHsWrapper</span></a></span><span>
</span><span id="line-445"></span><span>                                    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; TcType -&gt; Scaled TcType
forall a. TcType -&gt; a -&gt; Scaled a
</span><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-var">Scaled</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121647"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121645"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121653"><span class="hs-identifier hs-var">inf_res_sigma</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681121642"><span class="hs-identifier hs-var">doc</span></a></span><span>
</span><span id="line-446"></span><span>               </span><span class="hs-comment">-- expr_wrap2' :: (inf_arg_ty -&gt; inf_res_sigma) &quot;-&gt;&quot;</span><span>
</span><span id="line-447"></span><span>               </span><span class="hs-comment">--                (pat_ty -&gt; inf_res_sigma)</span><span>
</span><span id="line-448"></span><span>              </span><span id="local-6989586621681121641"><span class="annot"><span class="annottext">expr_wrap :: HsWrapper
</span><a href="#local-6989586621681121641"><span class="hs-identifier hs-var hs-var">expr_wrap</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121644"><span class="hs-identifier hs-var">expr_wrap2'</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper -&gt; HsWrapper -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121656"><span class="hs-identifier hs-var">expr_wrap1</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper -&gt; HsWrapper -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121662"><span class="hs-identifier hs-var">mult_wrap</span></a></span><span>
</span><span id="line-449"></span><span>              </span><span id="local-6989586621681121642"><span class="annot"><span class="annottext">doc :: SDoc
</span><a href="#local-6989586621681121642"><span class="hs-identifier hs-var hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;When checking the view pattern function:&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsExpr GhcRn -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcRn
</span><a href="#local-6989586621681121664"><span class="hs-identifier hs-var">expr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-450"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Pat GhcTc, r) -&gt; TcM (Pat GhcTc, r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XViewPat GhcTc -&gt; LHsExpr GhcTc -&gt; LPat GhcTc -&gt; Pat GhcTc
forall p. XViewPat p -&gt; LHsExpr p -&gt; LPat p -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#ViewPat"><span class="hs-identifier hs-var">ViewPat</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
XViewPat GhcTc
</span><a href="#local-6989586621681121645"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper -&gt; LHsExpr GhcTc -&gt; LHsExpr GhcTc
</span><a href="GHC.Hs.Utils.html#mkLHsWrap"><span class="hs-identifier hs-var">mkLHsWrap</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121641"><span class="hs-identifier hs-var">expr_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcTc
</span><a href="#local-6989586621681121661"><span class="hs-identifier hs-var">expr'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcTc)
LPat GhcTc
</span><a href="#local-6989586621681121649"><span class="hs-identifier hs-var">pat'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121648"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span class="hs-special">}</span><span>
</span><span id="line-451"></span><span>
</span><span id="line-452"></span><span class="hs-comment">{- Note [View patterns and polymorphism]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider this exotic example:
   pair :: forall a. Bool -&gt; a -&gt; forall b. b -&gt; (a,b)

   f :: Int -&gt; blah
   f (pair True -&gt; x) = ...here (x :: forall b. b -&gt; (Int,b))

The expresion (pair True) should have type
    pair True :: Int -&gt; forall b. b -&gt; (Int,b)
so that it is ready to consume the incoming Int. It should be an
arrow type (t1 -&gt; t2); hence using (tcInferRho expr).

Then, when taking that arrow apart we want to get a *sigma* type
(forall b. b-&gt;(Int,b)), because that's what we want to bind 'x' to.
Fortunately that's what matchExpectedFunTySigma returns anyway.
-}</span><span>
</span><span id="line-469"></span><span>
</span><span id="line-470"></span><span class="hs-comment">-- Type signatures in patterns</span><span>
</span><span id="line-471"></span><span class="hs-comment">-- See Note [Pattern coercions] below</span><span>
</span><span id="line-472"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#SigPat"><span class="hs-identifier hs-type">SigPat</span></a></span><span> </span><span class="annot"><span class="annottext">XSigPat GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681121637"><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121637"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span id="local-6989586621681121636"><span class="annot"><span class="annottext">HsPatSigType (NoGhcTc GhcRn)
</span><a href="#local-6989586621681121636"><span class="hs-identifier hs-var">sig_ty</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-473"></span><span>        </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121635"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121635"><span class="hs-identifier hs-var">inner_ty</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121634"><span class="annot"><span class="annottext">[(Name, TyVar)]
</span><a href="#local-6989586621681121634"><span class="hs-identifier hs-var">tv_binds</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121633"><span class="annot"><span class="annottext">[(Name, TyVar)]
</span><a href="#local-6989586621681121633"><span class="hs-identifier hs-var">wcs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121632"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121632"><span class="hs-identifier hs-var">wrap</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; HsPatSigType GhcRn
-&gt; ExpSigmaType
-&gt; TcM (TcType, [(Name, TyVar)], [(Name, TyVar)], HsWrapper)
</span><a href="GHC.Tc.Gen.Pat.html#tcPatSig"><span class="hs-identifier hs-var">tcPatSig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PatEnv -&gt; Bool
</span><a href="GHC.Tc.Gen.Pat.html#inPatBind"><span class="hs-identifier hs-var">inPatBind</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-474"></span><span>                                                            </span><span class="annot"><span class="annottext">HsPatSigType GhcRn
HsPatSigType (NoGhcTc GhcRn)
</span><a href="#local-6989586621681121636"><span class="hs-identifier hs-var">sig_ty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-475"></span><span>                </span><span class="hs-comment">-- Using tcExtendNameTyVarEnv is appropriate here</span><span>
</span><span id="line-476"></span><span>                </span><span class="hs-comment">-- because we're not really bringing fresh tyvars into scope.</span><span>
</span><span id="line-477"></span><span>                </span><span class="hs-comment">-- We're *naming* existing tyvars. Note that it is OK for a tyvar</span><span>
</span><span id="line-478"></span><span>                </span><span class="hs-comment">-- from an outer scope to mention one of these tyvars in its kind.</span><span>
</span><span id="line-479"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121630"><span class="annot"><span class="annottext">Located (Pat GhcTc)
</span><a href="#local-6989586621681121630"><span class="hs-identifier hs-var">pat'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121629"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121629"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Name, TyVar)]
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r)
forall r. [(Name, TyVar)] -&gt; TcM r -&gt; TcM r
</span><a href="GHC.Tc.Utils.Env.html#tcExtendNameTyVarEnv"><span class="hs-identifier hs-var">tcExtendNameTyVarEnv</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, TyVar)]
</span><a href="#local-6989586621681121633"><span class="hs-identifier hs-var">wcs</span></a></span><span>      </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r)
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-480"></span><span>                         </span><span class="annot"><span class="annottext">[(Name, TyVar)]
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r)
forall r. [(Name, TyVar)] -&gt; TcM r -&gt; TcM r
</span><a href="GHC.Tc.Utils.Env.html#tcExtendNameTyVarEnv"><span class="hs-identifier hs-var">tcExtendNameTyVarEnv</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, TyVar)]
</span><a href="#local-6989586621681121634"><span class="hs-identifier hs-var">tv_binds</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r)
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Located (Pat GhcTc), r)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-481"></span><span>                         </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; Checker (LPat GhcRn) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpat"><span class="hs-identifier hs-var">tc_lpat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType -&gt; Scaled ExpSigmaType
forall a b. Scaled a -&gt; b -&gt; Scaled b
</span><a href="GHC.Core.Type.html#scaledSet"><span class="hs-operator hs-var">`scaledSet`</span></a></span><span> </span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121635"><span class="hs-identifier hs-var">inner_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121637"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-482"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121627"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121627"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#readExpType"><span class="hs-identifier hs-var">readExpType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-483"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Pat GhcTc, r) -&gt; TcM (Pat GhcTc, r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper -&gt; Pat GhcTc -&gt; TcType -&gt; Pat GhcTc
</span><a href="GHC.Hs.Utils.html#mkHsWrapPat"><span class="hs-identifier hs-var">mkHsWrapPat</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121632"><span class="hs-identifier hs-var">wrap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XSigPat GhcTc
-&gt; LPat GhcTc -&gt; HsPatSigType (NoGhcTc GhcTc) -&gt; Pat GhcTc
forall p. XSigPat p -&gt; LPat p -&gt; HsPatSigType (NoGhcTc p) -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#SigPat"><span class="hs-identifier hs-var">SigPat</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
XSigPat GhcTc
</span><a href="#local-6989586621681121635"><span class="hs-identifier hs-var">inner_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcTc)
LPat GhcTc
</span><a href="#local-6989586621681121630"><span class="hs-identifier hs-var">pat'</span></a></span><span> </span><span class="annot"><span class="annottext">HsPatSigType (NoGhcTc GhcRn)
HsPatSigType (NoGhcTc GhcTc)
</span><a href="#local-6989586621681121636"><span class="hs-identifier hs-var">sig_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121627"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121629"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-484"></span><span>
</span><span id="line-485"></span><span class="hs-comment">------------------------</span><span>
</span><span id="line-486"></span><span class="hs-comment">-- Lists, tuples, arrays</span><span>
</span><span id="line-487"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#ListPat"><span class="hs-identifier hs-type">ListPat</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe SyntaxExprRn
XListPat GhcRn
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span id="local-6989586621681121625"><span class="annot"><span class="annottext">[LPat GhcRn]
</span><a href="#local-6989586621681121625"><span class="hs-identifier hs-var">pats</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-488"></span><span>        </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121624"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121624"><span class="hs-identifier hs-var">coi</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121623"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121623"><span class="hs-identifier hs-var">elt_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(TcType -&gt; IOEnv (Env TcGblEnv TcLclEnv) (TcCoercionN, TcType))
-&gt; PatEnv -&gt; ExpSigmaType -&gt; TcM (HsWrapper, TcType)
forall a.
(TcType -&gt; TcM (TcCoercionN, a))
-&gt; PatEnv -&gt; ExpSigmaType -&gt; TcM (HsWrapper, a)
</span><a href="GHC.Tc.Gen.Pat.html#matchExpectedPatTy"><span class="hs-identifier hs-var">matchExpectedPatTy</span></a></span><span> </span><span class="annot"><span class="annottext">TcType -&gt; IOEnv (Env TcGblEnv TcLclEnv) (TcCoercionN, TcType)
</span><a href="GHC.Tc.Utils.Unify.html#matchExpectedListTy"><span class="hs-identifier hs-var">matchExpectedListTy</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-489"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121620"><span class="annot"><span class="annottext">[Located (Pat GhcTc)]
</span><a href="#local-6989586621681121620"><span class="hs-identifier hs-var">pats'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121619"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121619"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Checker (GenLocated SrcSpan (Pat GhcRn)) (Located (Pat GhcTc))
-&gt; Checker [GenLocated SrcSpan (Pat GhcRn)] [Located (Pat GhcTc)]
forall inp out. Checker inp out -&gt; Checker [inp] [out]
</span><a href="GHC.Tc.Gen.Pat.html#tcMultiple"><span class="hs-identifier hs-var">tcMultiple</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; Checker (LPat GhcRn) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpat"><span class="hs-identifier hs-var">tc_lpat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType -&gt; Scaled ExpSigmaType
forall a b. Scaled a -&gt; b -&gt; Scaled b
</span><a href="GHC.Core.Type.html#scaledSet"><span class="hs-operator hs-var">`scaledSet`</span></a></span><span> </span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121623"><span class="hs-identifier hs-var">elt_ty</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-490"></span><span>                                     </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan (Pat GhcRn)]
[LPat GhcRn]
</span><a href="#local-6989586621681121625"><span class="hs-identifier hs-var">pats</span></a></span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-491"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121618"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121618"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#readExpType"><span class="hs-identifier hs-var">readExpType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-492"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Pat GhcTc, r) -&gt; TcM (Pat GhcTc, r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper -&gt; Pat GhcTc -&gt; TcType -&gt; Pat GhcTc
</span><a href="GHC.Hs.Utils.html#mkHsWrapPat"><span class="hs-identifier hs-var">mkHsWrapPat</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121624"><span class="hs-identifier hs-var">coi</span></a></span><span>
</span><span id="line-493"></span><span>                         </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XListPat GhcTc -&gt; [LPat GhcTc] -&gt; Pat GhcTc
forall p. XListPat p -&gt; [LPat p] -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#ListPat"><span class="hs-identifier hs-var">ListPat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; Maybe (TcType, SyntaxExpr GhcTc) -&gt; ListPatTc
</span><a href="GHC.Hs.Pat.html#ListPatTc"><span class="hs-identifier hs-var">ListPatTc</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121623"><span class="hs-identifier hs-var">elt_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (TcType, SyntaxExpr GhcTc)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Located (Pat GhcTc)]
[LPat GhcTc]
</span><a href="#local-6989586621681121620"><span class="hs-identifier hs-var">pats'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121618"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121619"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-494"></span><span class="hs-special">}</span><span>
</span><span id="line-495"></span><span>
</span><span id="line-496"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#ListPat"><span class="hs-identifier hs-type">ListPat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681121616"><span class="annot"><span class="annottext">SyntaxExprRn
</span><a href="#local-6989586621681121616"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681121615"><span class="annot"><span class="annottext">[LPat GhcRn]
</span><a href="#local-6989586621681121615"><span class="hs-identifier hs-var">pats</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-497"></span><span>        </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121614"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121614"><span class="hs-identifier hs-var">tau_pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#expTypeToType"><span class="hs-identifier hs-var">expTypeToType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-498"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621681121613"><span class="annot"><span class="annottext">[Located (Pat GhcTc)]
</span><a href="#local-6989586621681121613"><span class="hs-identifier hs-var">pats'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121612"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121612"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121611"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121611"><span class="hs-identifier hs-var">elt_ty</span></a></span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121610"><span class="annot"><span class="annottext">SyntaxExprTc
</span><a href="#local-6989586621681121610"><span class="hs-identifier hs-var">e'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-499"></span><span>            </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CtOrigin
-&gt; SyntaxExprRn
-&gt; [SyntaxOpType]
-&gt; SyntaxOpType
-&gt; ([TcType] -&gt; [TcType] -&gt; TcM ([Located (Pat GhcTc)], r, TcType))
-&gt; TcM (([Located (Pat GhcTc)], r, TcType), SyntaxExprTc)
forall a.
CtOrigin
-&gt; SyntaxExprRn
-&gt; [SyntaxOpType]
-&gt; SyntaxOpType
-&gt; ([TcType] -&gt; [TcType] -&gt; TcM a)
-&gt; TcM (a, SyntaxExprTc)
</span><a href="GHC.Tc.Gen.Expr.html#tcSyntaxOpGen"><span class="hs-identifier hs-var">tcSyntaxOpGen</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="GHC.Tc.Types.Origin.html#ListOrigin"><span class="hs-identifier hs-var">ListOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">SyntaxExprRn
</span><a href="#local-6989586621681121616"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ExpSigmaType -&gt; SyntaxOpType
</span><a href="GHC.Tc.Utils.TcType.html#SynType"><span class="hs-identifier hs-var">SynType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121614"><span class="hs-identifier hs-var">tau_pat_ty</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-500"></span><span>                                          </span><span class="annot"><span class="annottext">SyntaxOpType
</span><a href="GHC.Tc.Utils.TcType.html#SynList"><span class="hs-identifier hs-var">SynList</span></a></span><span> </span><span class="annot"><span class="annottext">(([TcType] -&gt; [TcType] -&gt; TcM ([Located (Pat GhcTc)], r, TcType))
 -&gt; TcM (([Located (Pat GhcTc)], r, TcType), SyntaxExprTc))
-&gt; ([TcType] -&gt; [TcType] -&gt; TcM ([Located (Pat GhcTc)], r, TcType))
-&gt; TcM (([Located (Pat GhcTc)], r, TcType), SyntaxExprTc)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-501"></span><span>                 </span><span class="hs-glyph">\</span><span> </span><span class="hs-special">[</span><span id="local-6989586621681121606"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121606"><span class="hs-identifier hs-var">elt_ty</span></a></span></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-502"></span><span>                 </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121605"><span class="annot"><span class="annottext">[Located (Pat GhcTc)]
</span><a href="#local-6989586621681121605"><span class="hs-identifier hs-var">pats'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121604"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121604"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Checker (GenLocated SrcSpan (Pat GhcRn)) (Located (Pat GhcTc))
-&gt; Checker [GenLocated SrcSpan (Pat GhcRn)] [Located (Pat GhcTc)]
forall inp out. Checker inp out -&gt; Checker [inp] [out]
</span><a href="GHC.Tc.Gen.Pat.html#tcMultiple"><span class="hs-identifier hs-var">tcMultiple</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; Checker (LPat GhcRn) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpat"><span class="hs-identifier hs-var">tc_lpat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType -&gt; Scaled ExpSigmaType
forall a b. Scaled a -&gt; b -&gt; Scaled b
</span><a href="GHC.Core.Type.html#scaledSet"><span class="hs-operator hs-var">`scaledSet`</span></a></span><span> </span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121606"><span class="hs-identifier hs-var">elt_ty</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-503"></span><span>                                                 </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan (Pat GhcRn)]
[LPat GhcRn]
</span><a href="#local-6989586621681121615"><span class="hs-identifier hs-var">pats</span></a></span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-504"></span><span>                    </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">([Located (Pat GhcTc)], r, TcType)
-&gt; TcM ([Located (Pat GhcTc)], r, TcType)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Located (Pat GhcTc)]
</span><a href="#local-6989586621681121605"><span class="hs-identifier hs-var">pats'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121604"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121606"><span class="hs-identifier hs-var">elt_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-505"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Pat GhcTc, r) -&gt; TcM (Pat GhcTc, r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XListPat GhcTc -&gt; [LPat GhcTc] -&gt; Pat GhcTc
forall p. XListPat p -&gt; [LPat p] -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#ListPat"><span class="hs-identifier hs-var">ListPat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; Maybe (TcType, SyntaxExpr GhcTc) -&gt; ListPatTc
</span><a href="GHC.Hs.Pat.html#ListPatTc"><span class="hs-identifier hs-var">ListPatTc</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121611"><span class="hs-identifier hs-var">elt_ty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(TcType, SyntaxExprTc) -&gt; Maybe (TcType, SyntaxExprTc)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121614"><span class="hs-identifier hs-var">tau_pat_ty</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">SyntaxExprTc
</span><a href="#local-6989586621681121610"><span class="hs-identifier hs-var">e'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Located (Pat GhcTc)]
[LPat GhcTc]
</span><a href="#local-6989586621681121613"><span class="hs-identifier hs-var">pats'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121612"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-506"></span><span class="hs-special">}</span><span>
</span><span id="line-507"></span><span>
</span><span id="line-508"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#TuplePat"><span class="hs-identifier hs-type">TuplePat</span></a></span><span> </span><span class="annot"><span class="annottext">XTuplePat GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681121602"><span class="annot"><span class="annottext">[LPat GhcRn]
</span><a href="#local-6989586621681121602"><span class="hs-identifier hs-var">pats</span></a></span></span><span> </span><span id="local-6989586621681121601"><span class="annot"><span class="annottext">Boxity
</span><a href="#local-6989586621681121601"><span class="hs-identifier hs-var">boxity</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-509"></span><span>        </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121600"><span class="annot"><span class="annottext">arity :: Int
</span><a href="#local-6989586621681121600"><span class="hs-identifier hs-var hs-var">arity</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan (Pat GhcRn)] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan (Pat GhcRn)]
[LPat GhcRn]
</span><a href="#local-6989586621681121602"><span class="hs-identifier hs-var">pats</span></a></span><span>
</span><span id="line-510"></span><span>              </span><span id="local-6989586621681121598"><span class="annot"><span class="annottext">tc :: TyCon
</span><a href="#local-6989586621681121598"><span class="hs-identifier hs-var hs-var">tc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Boxity -&gt; Int -&gt; TyCon
</span><a href="GHC.Builtin.Types.html#tupleTyCon"><span class="hs-identifier hs-var">tupleTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Boxity
</span><a href="#local-6989586621681121601"><span class="hs-identifier hs-var">boxity</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681121600"><span class="hs-identifier hs-var">arity</span></a></span><span>
</span><span id="line-511"></span><span>              </span><span class="hs-comment">-- NB: tupleTyCon does not flatten 1-tuples</span><span>
</span><span id="line-512"></span><span>              </span><span class="hs-comment">-- See Note [Don't flatten tuples from HsSyn] in GHC.Core.Make</span><span>
</span><span id="line-513"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121596"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121596"><span class="hs-identifier hs-var">coi</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121595"><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121595"><span class="hs-identifier hs-var">arg_tys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(TcType -&gt; TcM (TcCoercionN, [TcType]))
-&gt; PatEnv -&gt; ExpSigmaType -&gt; TcM (HsWrapper, [TcType])
forall a.
(TcType -&gt; TcM (TcCoercionN, a))
-&gt; PatEnv -&gt; ExpSigmaType -&gt; TcM (HsWrapper, a)
</span><a href="GHC.Tc.Gen.Pat.html#matchExpectedPatTy"><span class="hs-identifier hs-var">matchExpectedPatTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; TcType -&gt; TcM (TcCoercionN, [TcType])
</span><a href="GHC.Tc.Utils.Unify.html#matchExpectedTyConApp"><span class="hs-identifier hs-var">matchExpectedTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681121598"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-514"></span><span>                                               </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-515"></span><span>                     </span><span class="hs-comment">-- Unboxed tuples have RuntimeRep vars, which we discard:</span><span>
</span><span id="line-516"></span><span>                     </span><span class="hs-comment">-- See Note [Unboxed tuple RuntimeRep vars] in GHC.Core.TyCon</span><span>
</span><span id="line-517"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121593"><span class="annot"><span class="annottext">con_arg_tys :: [TcType]
</span><a href="#local-6989586621681121593"><span class="hs-identifier hs-var hs-var">con_arg_tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Boxity
</span><a href="#local-6989586621681121601"><span class="hs-identifier hs-var">boxity</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="annot"><span class="annottext">Boxity
</span><a href="GHC.Types.Basic.html#Unboxed"><span class="hs-identifier hs-var">Unboxed</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [TcType] -&gt; [TcType]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#drop"><span class="hs-identifier hs-var">drop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681121600"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121595"><span class="hs-identifier hs-var">arg_tys</span></a></span><span>
</span><span id="line-518"></span><span>                                           </span><span class="annot"><span class="annottext">Boxity
</span><a href="GHC.Types.Basic.html#Boxed"><span class="hs-identifier hs-var">Boxed</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121595"><span class="hs-identifier hs-var">arg_tys</span></a></span><span>
</span><span id="line-519"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121589"><span class="annot"><span class="annottext">[Located (Pat GhcTc)]
</span><a href="#local-6989586621681121589"><span class="hs-identifier hs-var">pats'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121588"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121588"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Scaled ExpSigmaType] -&gt; Checker [LPat GhcRn] [LPat GhcTc]
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpats"><span class="hs-identifier hs-var">tc_lpats</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(TcType -&gt; Scaled ExpSigmaType)
-&gt; [TcType] -&gt; [Scaled ExpSigmaType]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType -&gt; Scaled ExpSigmaType
forall a b. Scaled a -&gt; b -&gt; Scaled b
</span><a href="GHC.Core.Type.html#scaledSet"><span class="hs-identifier hs-var">scaledSet</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">(ExpSigmaType -&gt; Scaled ExpSigmaType)
-&gt; (TcType -&gt; ExpSigmaType) -&gt; TcType -&gt; Scaled ExpSigmaType
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121593"><span class="hs-identifier hs-var">con_arg_tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-520"></span><span>                                   </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">[LPat GhcRn]
</span><a href="#local-6989586621681121602"><span class="hs-identifier hs-var">pats</span></a></span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-521"></span><span>
</span><span id="line-522"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121586"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681121586"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-523"></span><span>
</span><span id="line-524"></span><span>        </span><span class="hs-comment">-- Under flag control turn a pattern (x,y,z) into ~(x,y,z)</span><span>
</span><span id="line-525"></span><span>        </span><span class="hs-comment">-- so that we can experiment with lazy tuple-matching.</span><span>
</span><span id="line-526"></span><span>        </span><span class="hs-comment">-- This is a pretty odd place to make the switch, but</span><span>
</span><span id="line-527"></span><span>        </span><span class="hs-comment">-- it was easy to do.</span><span>
</span><span id="line-528"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-529"></span><span>              </span><span id="local-6989586621681121584"><span class="annot"><span class="annottext">unmangled_result :: Pat GhcTc
</span><a href="#local-6989586621681121584"><span class="hs-identifier hs-var hs-var">unmangled_result</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XTuplePat GhcTc -&gt; [LPat GhcTc] -&gt; Boxity -&gt; Pat GhcTc
forall p. XTuplePat p -&gt; [LPat p] -&gt; Boxity -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#TuplePat"><span class="hs-identifier hs-var">TuplePat</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
XTuplePat GhcTc
</span><a href="#local-6989586621681121593"><span class="hs-identifier hs-var">con_arg_tys</span></a></span><span> </span><span class="annot"><span class="annottext">[Located (Pat GhcTc)]
[LPat GhcTc]
</span><a href="#local-6989586621681121589"><span class="hs-identifier hs-var">pats'</span></a></span><span> </span><span class="annot"><span class="annottext">Boxity
</span><a href="#local-6989586621681121601"><span class="hs-identifier hs-var">boxity</span></a></span><span>
</span><span id="line-530"></span><span>                                 </span><span class="hs-comment">-- pat_ty /= pat_ty iff coi /= IdCo</span><span>
</span><span id="line-531"></span><span>              </span><span id="local-6989586621681121583"><span class="annot"><span class="annottext">possibly_mangled_result :: Pat GhcTc
</span><a href="#local-6989586621681121583"><span class="hs-identifier hs-var hs-var">possibly_mangled_result</span></a></span></span><span>
</span><span id="line-532"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">GeneralFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#gopt"><span class="hs-identifier hs-var">gopt</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralFlag
</span><a href="GHC.Driver.Flags.html#Opt_IrrefutableTuples"><span class="hs-identifier hs-var">Opt_IrrefutableTuples</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681121586"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span>
</span><span id="line-533"></span><span>                  </span><span class="annot"><span class="annottext">Boxity -&gt; Bool
</span><a href="GHC.Types.Basic.html#isBoxed"><span class="hs-identifier hs-var">isBoxed</span></a></span><span> </span><span class="annot"><span class="annottext">Boxity
</span><a href="#local-6989586621681121601"><span class="hs-identifier hs-var">boxity</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XLazyPat GhcTc -&gt; LPat GhcTc -&gt; Pat GhcTc
forall p. XLazyPat p -&gt; LPat p -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#LazyPat"><span class="hs-identifier hs-var">LazyPat</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XLazyPat GhcTc
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Pat GhcTc -&gt; Located (Pat GhcTc)
forall e. e -&gt; Located e
</span><a href="GHC.Types.SrcLoc.html#noLoc"><span class="hs-identifier hs-var">noLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Pat GhcTc
</span><a href="#local-6989586621681121584"><span class="hs-identifier hs-var">unmangled_result</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-534"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Pat GhcTc
</span><a href="#local-6989586621681121584"><span class="hs-identifier hs-var">unmangled_result</span></a></span><span>
</span><span id="line-535"></span><span>
</span><span id="line-536"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121577"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121577"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#readExpType"><span class="hs-identifier hs-var">readExpType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-537"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">con_arg_tys</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">equalLength</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">pats</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Syntactically enforced</span><span>
</span><span id="line-538"></span><span>          </span><span class="annot"><span class="annottext">(Pat GhcTc, r) -&gt; TcM (Pat GhcTc, r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper -&gt; Pat GhcTc -&gt; TcType -&gt; Pat GhcTc
</span><a href="GHC.Hs.Utils.html#mkHsWrapPat"><span class="hs-identifier hs-var">mkHsWrapPat</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121596"><span class="hs-identifier hs-var">coi</span></a></span><span> </span><span class="annot"><span class="annottext">Pat GhcTc
</span><a href="#local-6989586621681121583"><span class="hs-identifier hs-var">possibly_mangled_result</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121577"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121588"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-539"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-540"></span><span>
</span><span id="line-541"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#SumPat"><span class="hs-identifier hs-type">SumPat</span></a></span><span> </span><span class="annot"><span class="annottext">XSumPat GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681121575"><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121575"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span id="local-6989586621681121574"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681121574"><span class="hs-identifier hs-var">alt</span></a></span></span><span> </span><span id="local-6989586621681121573"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681121573"><span class="hs-identifier hs-var">arity</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-542"></span><span>        </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121572"><span class="annot"><span class="annottext">tc :: TyCon
</span><a href="#local-6989586621681121572"><span class="hs-identifier hs-var hs-var">tc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; TyCon
</span><a href="GHC.Builtin.Types.html#sumTyCon"><span class="hs-identifier hs-var">sumTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681121573"><span class="hs-identifier hs-var">arity</span></a></span><span>
</span><span id="line-543"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121570"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121570"><span class="hs-identifier hs-var">coi</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121569"><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121569"><span class="hs-identifier hs-var">arg_tys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(TcType -&gt; TcM (TcCoercionN, [TcType]))
-&gt; PatEnv -&gt; ExpSigmaType -&gt; TcM (HsWrapper, [TcType])
forall a.
(TcType -&gt; TcM (TcCoercionN, a))
-&gt; PatEnv -&gt; ExpSigmaType -&gt; TcM (HsWrapper, a)
</span><a href="GHC.Tc.Gen.Pat.html#matchExpectedPatTy"><span class="hs-identifier hs-var">matchExpectedPatTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; TcType -&gt; TcM (TcCoercionN, [TcType])
</span><a href="GHC.Tc.Utils.Unify.html#matchExpectedTyConApp"><span class="hs-identifier hs-var">matchExpectedTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681121572"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-544"></span><span>                                               </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-545"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-comment">-- Drop levity vars, we don't care about them here</span><span>
</span><span id="line-546"></span><span>          </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121568"><span class="annot"><span class="annottext">con_arg_tys :: [TcType]
</span><a href="#local-6989586621681121568"><span class="hs-identifier hs-var hs-var">con_arg_tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [TcType] -&gt; [TcType]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#drop"><span class="hs-identifier hs-var">drop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681121573"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121569"><span class="hs-identifier hs-var">arg_tys</span></a></span><span>
</span><span id="line-547"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121567"><span class="annot"><span class="annottext">Located (Pat GhcTc)
</span><a href="#local-6989586621681121567"><span class="hs-identifier hs-var">pat'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121566"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121566"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; Checker (LPat GhcRn) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpat"><span class="hs-identifier hs-var">tc_lpat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType -&gt; Scaled ExpSigmaType
forall a b. Scaled a -&gt; b -&gt; Scaled b
</span><a href="GHC.Core.Type.html#scaledSet"><span class="hs-operator hs-var">`scaledSet`</span></a></span><span> </span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121568"><span class="hs-identifier hs-var">con_arg_tys</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType] -&gt; Int -&gt; TcType
forall a. Outputable a =&gt; [a] -&gt; Int -&gt; a
</span><a href="GHC.Data.List.SetOps.html#getNth"><span class="hs-operator hs-var">`getNth`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681121574"><span class="hs-identifier hs-var">alt</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-548"></span><span>                                 </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121575"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-549"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121565"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121565"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#readExpType"><span class="hs-identifier hs-var">readExpType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-550"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Pat GhcTc, r) -&gt; TcM (Pat GhcTc, r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper -&gt; Pat GhcTc -&gt; TcType -&gt; Pat GhcTc
</span><a href="GHC.Hs.Utils.html#mkHsWrapPat"><span class="hs-identifier hs-var">mkHsWrapPat</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121570"><span class="hs-identifier hs-var">coi</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XSumPat GhcTc -&gt; LPat GhcTc -&gt; Int -&gt; Int -&gt; Pat GhcTc
forall p. XSumPat p -&gt; LPat p -&gt; Int -&gt; Int -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#SumPat"><span class="hs-identifier hs-var">SumPat</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
XSumPat GhcTc
</span><a href="#local-6989586621681121568"><span class="hs-identifier hs-var">con_arg_tys</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcTc)
LPat GhcTc
</span><a href="#local-6989586621681121567"><span class="hs-identifier hs-var">pat'</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681121574"><span class="hs-identifier hs-var">alt</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681121573"><span class="hs-identifier hs-var">arity</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121565"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-551"></span><span>                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121566"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-552"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-553"></span><span>
</span><span id="line-554"></span><span class="hs-comment">------------------------</span><span>
</span><span id="line-555"></span><span class="hs-comment">-- Data constructors</span><span>
</span><span id="line-556"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#ConPat"><span class="hs-identifier hs-type">ConPat</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XConPat GhcRn
</span><a href="GHC.Hs.Extension.html#NoExtField"><span class="hs-identifier hs-var">NoExtField</span></a></span><span> </span><span id="local-6989586621681121562"><span class="annot"><span class="annottext">Located (ConLikeP GhcRn)
</span><a href="#local-6989586621681121562"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span id="local-6989586621681121561"><span class="annot"><span class="annottext">HsConPatDetails GhcRn
</span><a href="#local-6989586621681121561"><span class="hs-identifier hs-var">arg_pats</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-557"></span><span>    </span><span class="annot"><span class="annottext">PatEnv
-&gt; Located Name
-&gt; Scaled ExpSigmaType
-&gt; HsConPatDetails GhcRn
-&gt; TcM r
-&gt; TcM (Pat GhcTc, r)
forall a.
PatEnv
-&gt; Located Name
-&gt; Scaled ExpSigmaType
-&gt; HsConPatDetails GhcRn
-&gt; TcM a
-&gt; TcM (Pat GhcTc, a)
</span><a href="GHC.Tc.Gen.Pat.html#tcConPat"><span class="hs-identifier hs-var">tcConPat</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">Located Name
Located (ConLikeP GhcRn)
</span><a href="#local-6989586621681121562"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">HsConPatDetails GhcRn
</span><a href="#local-6989586621681121561"><span class="hs-identifier hs-var">arg_pats</span></a></span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-558"></span><span>
</span><span id="line-559"></span><span class="hs-comment">------------------------</span><span>
</span><span id="line-560"></span><span class="hs-comment">-- Literal patterns</span><span>
</span><span id="line-561"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#LitPat"><span class="hs-identifier hs-type">LitPat</span></a></span><span> </span><span id="local-6989586621681121558"><span class="annot"><span class="annottext">XLitPat GhcRn
</span><a href="#local-6989586621681121558"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681121557"><span class="annot"><span class="annottext">HsLit GhcRn
</span><a href="#local-6989586621681121557"><span class="hs-identifier hs-var">simple_lit</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-562"></span><span>        </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121556"><span class="annot"><span class="annottext">lit_ty :: TcType
</span><a href="#local-6989586621681121556"><span class="hs-identifier hs-var hs-var">lit_ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsLit GhcRn -&gt; TcType
forall (p :: Pass). HsLit (GhcPass p) -&gt; TcType
</span><a href="GHC.Tc.Utils.Zonk.html#hsLitType"><span class="hs-identifier hs-var">hsLitType</span></a></span><span> </span><span class="annot"><span class="annottext">HsLit GhcRn
</span><a href="#local-6989586621681121557"><span class="hs-identifier hs-var">simple_lit</span></a></span><span>
</span><span id="line-563"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121554"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121554"><span class="hs-identifier hs-var">wrap</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">PatEnv -&gt; ExpSigmaType -&gt; TcType -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Gen.Pat.html#tc_sub_type"><span class="hs-identifier hs-var">tc_sub_type</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121556"><span class="hs-identifier hs-var">lit_ty</span></a></span><span>
</span><span id="line-564"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121553"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121553"><span class="hs-identifier hs-var">res</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-565"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121552"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121552"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#readExpType"><span class="hs-identifier hs-var">readExpType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-566"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Pat GhcTc, r) -&gt; TcM (Pat GhcTc, r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">HsWrapper -&gt; Pat GhcTc -&gt; TcType -&gt; Pat GhcTc
</span><a href="GHC.Hs.Utils.html#mkHsWrapPat"><span class="hs-identifier hs-var">mkHsWrapPat</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121554"><span class="hs-identifier hs-var">wrap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XLitPat GhcTc -&gt; HsLit GhcTc -&gt; Pat GhcTc
forall p. XLitPat p -&gt; HsLit p -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#LitPat"><span class="hs-identifier hs-var">LitPat</span></a></span><span> </span><span class="annot"><span class="annottext">XLitPat GhcRn
XLitPat GhcTc
</span><a href="#local-6989586621681121558"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsLit GhcRn -&gt; HsLit GhcTc
forall (p1 :: Pass) (p2 :: Pass).
HsLit (GhcPass p1) -&gt; HsLit (GhcPass p2)
</span><a href="GHC.Hs.Lit.html#convertLit"><span class="hs-identifier hs-var">convertLit</span></a></span><span> </span><span class="annot"><span class="annottext">HsLit GhcRn
</span><a href="#local-6989586621681121557"><span class="hs-identifier hs-var">simple_lit</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121552"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-567"></span><span>                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121553"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-568"></span><span>
</span><span id="line-569"></span><span class="hs-comment">------------------------</span><span>
</span><span id="line-570"></span><span class="hs-comment">-- Overloaded patterns: n, and n+k</span><span>
</span><span id="line-571"></span><span>
</span><span id="line-572"></span><span class="hs-comment">-- In the case of a negative literal (the more complicated case),</span><span>
</span><span id="line-573"></span><span class="hs-comment">-- we get</span><span>
</span><span id="line-574"></span><span class="hs-comment">--</span><span>
</span><span id="line-575"></span><span class="hs-comment">--   case v of (-5) -&gt; blah</span><span>
</span><span id="line-576"></span><span class="hs-comment">--</span><span>
</span><span id="line-577"></span><span class="hs-comment">-- becoming</span><span>
</span><span id="line-578"></span><span class="hs-comment">--</span><span>
</span><span id="line-579"></span><span class="hs-comment">--   if v == (negate (fromInteger 5)) then blah else ...</span><span>
</span><span id="line-580"></span><span class="hs-comment">--</span><span>
</span><span id="line-581"></span><span class="hs-comment">-- There are two bits of rebindable syntax:</span><span>
</span><span id="line-582"></span><span class="hs-comment">--   (==)   :: pat_ty -&gt; neg_lit_ty -&gt; Bool</span><span>
</span><span id="line-583"></span><span class="hs-comment">--   negate :: lit_ty -&gt; neg_lit_ty</span><span>
</span><span id="line-584"></span><span class="hs-comment">-- where lit_ty is the type of the overloaded literal 5.</span><span>
</span><span id="line-585"></span><span class="hs-comment">--</span><span>
</span><span id="line-586"></span><span class="hs-comment">-- When there is no negation, neg_lit_ty and lit_ty are the same</span><span>
</span><span id="line-587"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#NPat"><span class="hs-identifier hs-type">NPat</span></a></span><span> </span><span class="annot"><span class="annottext">XNPat GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681121549"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121549"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681121548"><span class="annot"><span class="annottext">HsOverLit GhcRn
</span><a href="#local-6989586621681121548"><span class="hs-identifier hs-var">over_lit</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681121547"><span class="annot"><span class="annottext">Maybe (SyntaxExpr GhcRn)
</span><a href="#local-6989586621681121547"><span class="hs-identifier hs-var">mb_neg</span></a></span></span><span> </span><span id="local-6989586621681121546"><span class="annot"><span class="annottext">SyntaxExpr GhcRn
</span><a href="#local-6989586621681121546"><span class="hs-identifier hs-var">eq</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-588"></span><span>        </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121545"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121545"><span class="hs-identifier hs-var">mult_wrap</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; TcM HsWrapper
forall a. Scaled a -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Gen.Pat.html#checkManyPattern"><span class="hs-identifier hs-var">checkManyPattern</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-589"></span><span>          </span><span class="hs-comment">-- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify.</span><span>
</span><span id="line-590"></span><span>          </span><span class="hs-comment">--</span><span>
</span><span id="line-591"></span><span>          </span><span class="hs-comment">-- It may be possible to refine linear pattern so that they work in</span><span>
</span><span id="line-592"></span><span>          </span><span class="hs-comment">-- linear environments. But it is not clear how useful this is.</span><span>
</span><span id="line-593"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121544"><span class="annot"><span class="annottext">orig :: CtOrigin
</span><a href="#local-6989586621681121544"><span class="hs-identifier hs-var hs-var">orig</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsOverLit GhcRn -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Origin.html#LiteralOrigin"><span class="hs-identifier hs-var">LiteralOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">HsOverLit GhcRn
</span><a href="#local-6989586621681121548"><span class="hs-identifier hs-var">over_lit</span></a></span><span>
</span><span id="line-594"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621681121542"><span class="annot"><span class="annottext">HsOverLit GhcTc
</span><a href="#local-6989586621681121542"><span class="hs-identifier hs-var">lit'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121541"><span class="annot"><span class="annottext">Maybe SyntaxExprTc
</span><a href="#local-6989586621681121541"><span class="hs-identifier hs-var">mb_neg'</span></a></span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121540"><span class="annot"><span class="annottext">SyntaxExprTc
</span><a href="#local-6989586621681121540"><span class="hs-identifier hs-var">eq'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-595"></span><span>            </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CtOrigin
-&gt; SyntaxExprRn
-&gt; [SyntaxOpType]
-&gt; ExpSigmaType
-&gt; ([TcType]
    -&gt; [TcType] -&gt; TcM (HsOverLit GhcTc, Maybe SyntaxExprTc))
-&gt; TcM ((HsOverLit GhcTc, Maybe SyntaxExprTc), SyntaxExprTc)
forall a.
CtOrigin
-&gt; SyntaxExprRn
-&gt; [SyntaxOpType]
-&gt; ExpSigmaType
-&gt; ([TcType] -&gt; [TcType] -&gt; TcM a)
-&gt; TcM (a, SyntaxExprTc)
</span><a href="GHC.Tc.Gen.Expr.html#tcSyntaxOp"><span class="hs-identifier hs-var">tcSyntaxOp</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621681121544"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="annot"><span class="annottext">SyntaxExpr GhcRn
SyntaxExprRn
</span><a href="#local-6989586621681121546"><span class="hs-identifier hs-var">eq</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ExpSigmaType -&gt; SyntaxOpType
</span><a href="GHC.Tc.Utils.TcType.html#SynType"><span class="hs-identifier hs-var">SynType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SyntaxOpType
</span><a href="GHC.Tc.Utils.TcType.html#SynAny"><span class="hs-identifier hs-var">SynAny</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-596"></span><span>                          </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="GHC.Builtin.Types.html#boolTy"><span class="hs-identifier hs-var">boolTy</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(([TcType]
  -&gt; [TcType] -&gt; TcM (HsOverLit GhcTc, Maybe SyntaxExprTc))
 -&gt; TcM ((HsOverLit GhcTc, Maybe SyntaxExprTc), SyntaxExprTc))
-&gt; ([TcType]
    -&gt; [TcType] -&gt; TcM (HsOverLit GhcTc, Maybe SyntaxExprTc))
-&gt; TcM ((HsOverLit GhcTc, Maybe SyntaxExprTc), SyntaxExprTc)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-597"></span><span>               </span><span class="hs-glyph">\</span><span> </span><span class="hs-special">[</span><span id="local-6989586621681121537"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121537"><span class="hs-identifier hs-var">neg_lit_ty</span></a></span></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-598"></span><span>               </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121536"><span class="annot"><span class="annottext">new_over_lit :: TcType -&gt; TcM (HsOverLit GhcTc)
</span><a href="#local-6989586621681121536"><span class="hs-identifier hs-var hs-var">new_over_lit</span></a></span></span><span> </span><span id="local-6989586621681121535"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121535"><span class="hs-identifier hs-var">lit_ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsOverLit GhcRn -&gt; ExpSigmaType -&gt; TcM (HsOverLit GhcTc)
</span><a href="GHC.Tc.Utils.Instantiate.html#newOverloadedLit"><span class="hs-identifier hs-var">newOverloadedLit</span></a></span><span> </span><span class="annot"><span class="annottext">HsOverLit GhcRn
</span><a href="#local-6989586621681121548"><span class="hs-identifier hs-var">over_lit</span></a></span><span>
</span><span id="line-599"></span><span>                                           </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121535"><span class="hs-identifier hs-var">lit_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-600"></span><span>               </span><span class="hs-keyword">in</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe (SyntaxExpr GhcRn)
</span><a href="#local-6989586621681121547"><span class="hs-identifier hs-var">mb_neg</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-601"></span><span>                 </span><span class="annot"><span class="annottext">Maybe (SyntaxExpr GhcRn)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-special">,</span></span><span> </span><span class="annot"><span class="annottext">Maybe SyntaxExprTc
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(HsOverLit GhcTc -&gt; (HsOverLit GhcTc, Maybe SyntaxExprTc))
-&gt; TcM (HsOverLit GhcTc)
-&gt; TcM (HsOverLit GhcTc, Maybe SyntaxExprTc)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TcType -&gt; TcM (HsOverLit GhcTc)
</span><a href="#local-6989586621681121536"><span class="hs-identifier hs-var">new_over_lit</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121537"><span class="hs-identifier hs-var">neg_lit_ty</span></a></span><span>
</span><span id="line-602"></span><span>                 </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681121532"><span class="annot"><span class="annottext">SyntaxExpr GhcRn
</span><a href="#local-6989586621681121532"><span class="hs-identifier hs-var">neg</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-comment">-- Negative literal</span><span>
</span><span id="line-603"></span><span>                             </span><span class="hs-comment">-- The 'negate' is re-mappable syntax</span><span>
</span><span id="line-604"></span><span>                   </span><span class="annot"><span class="annottext">(SyntaxExprTc -&gt; Maybe SyntaxExprTc)
-&gt; (HsOverLit GhcTc, SyntaxExprTc)
-&gt; (HsOverLit GhcTc, Maybe SyntaxExprTc)
forall (a :: * -&gt; * -&gt; *) b c d.
Arrow a =&gt;
a b c -&gt; a (d, b) (d, c)
</span><a href="../../base/src/Control.Arrow.html#second"><span class="hs-identifier hs-var">second</span></a></span><span> </span><span class="annot"><span class="annottext">SyntaxExprTc -&gt; Maybe SyntaxExprTc
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">((HsOverLit GhcTc, SyntaxExprTc)
 -&gt; (HsOverLit GhcTc, Maybe SyntaxExprTc))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (HsOverLit GhcTc, SyntaxExprTc)
-&gt; TcM (HsOverLit GhcTc, Maybe SyntaxExprTc)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span>
</span><span id="line-605"></span><span>                   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtOrigin
-&gt; SyntaxExprRn
-&gt; [SyntaxOpType]
-&gt; ExpSigmaType
-&gt; ([TcType] -&gt; [TcType] -&gt; TcM (HsOverLit GhcTc))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (HsOverLit GhcTc, SyntaxExprTc)
forall a.
CtOrigin
-&gt; SyntaxExprRn
-&gt; [SyntaxOpType]
-&gt; ExpSigmaType
-&gt; ([TcType] -&gt; [TcType] -&gt; TcM a)
-&gt; TcM (a, SyntaxExprTc)
</span><a href="GHC.Tc.Gen.Expr.html#tcSyntaxOp"><span class="hs-identifier hs-var">tcSyntaxOp</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621681121544"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="annot"><span class="annottext">SyntaxExpr GhcRn
SyntaxExprRn
</span><a href="#local-6989586621681121532"><span class="hs-identifier hs-var">neg</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">SyntaxOpType
</span><a href="GHC.Tc.Utils.TcType.html#SynRho"><span class="hs-identifier hs-var">SynRho</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121537"><span class="hs-identifier hs-var">neg_lit_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(([TcType] -&gt; [TcType] -&gt; TcM (HsOverLit GhcTc))
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) (HsOverLit GhcTc, SyntaxExprTc))
-&gt; ([TcType] -&gt; [TcType] -&gt; TcM (HsOverLit GhcTc))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (HsOverLit GhcTc, SyntaxExprTc)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-606"></span><span>                    </span><span class="hs-glyph">\</span><span> </span><span class="hs-special">[</span><span id="local-6989586621681121530"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121530"><span class="hs-identifier hs-var">lit_ty</span></a></span></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TcType -&gt; TcM (HsOverLit GhcTc)
</span><a href="#local-6989586621681121536"><span class="hs-identifier hs-var">new_over_lit</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121530"><span class="hs-identifier hs-var">lit_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-607"></span><span>                     </span><span class="hs-comment">-- applied to a closed literal: linearity doesn't matter as</span><span>
</span><span id="line-608"></span><span>                     </span><span class="hs-comment">-- literals are typed in an empty environment, hence have</span><span>
</span><span id="line-609"></span><span>                     </span><span class="hs-comment">-- all multiplicities.</span><span>
</span><span id="line-610"></span><span>
</span><span id="line-611"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121529"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121529"><span class="hs-identifier hs-var">res</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-612"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121528"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121528"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#readExpType"><span class="hs-identifier hs-var">readExpType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-613"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Pat GhcTc, r) -&gt; TcM (Pat GhcTc, r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper -&gt; Pat GhcTc -&gt; TcType -&gt; Pat GhcTc
</span><a href="GHC.Hs.Utils.html#mkHsWrapPat"><span class="hs-identifier hs-var">mkHsWrapPat</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121545"><span class="hs-identifier hs-var">mult_wrap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XNPat GhcTc
-&gt; Located (HsOverLit GhcTc)
-&gt; Maybe (SyntaxExpr GhcTc)
-&gt; SyntaxExpr GhcTc
-&gt; Pat GhcTc
forall p.
XNPat p
-&gt; Located (HsOverLit p)
-&gt; Maybe (SyntaxExpr p)
-&gt; SyntaxExpr p
-&gt; Pat p
</span><a href="GHC.Hs.Pat.html#NPat"><span class="hs-identifier hs-var">NPat</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
XNPat GhcTc
</span><a href="#local-6989586621681121528"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; HsOverLit GhcTc -&gt; Located (HsOverLit GhcTc)
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121549"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">HsOverLit GhcTc
</span><a href="#local-6989586621681121542"><span class="hs-identifier hs-var">lit'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe (SyntaxExpr GhcTc)
Maybe SyntaxExprTc
</span><a href="#local-6989586621681121541"><span class="hs-identifier hs-var">mb_neg'</span></a></span><span> </span><span class="annot"><span class="annottext">SyntaxExpr GhcTc
SyntaxExprTc
</span><a href="#local-6989586621681121540"><span class="hs-identifier hs-var">eq'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121528"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121529"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-614"></span><span>
</span><span id="line-615"></span><span class="hs-comment">{-
Note [NPlusK patterns]
~~~~~~~~~~~~~~~~~~~~~~
From

  case v of x + 5 -&gt; blah

we get

  if v &gt;= 5 then (\x -&gt; blah) (v - 5) else ...

There are two bits of rebindable syntax:
  (&gt;=) :: pat_ty -&gt; lit1_ty -&gt; Bool
  (-)  :: pat_ty -&gt; lit2_ty -&gt; var_ty

lit1_ty and lit2_ty could conceivably be different.
var_ty is the type inferred for x, the variable in the pattern.

Note that we need to type-check the literal twice, because it is used
twice, and may be used at different types. The second HsOverLit stored in the
AST is used for the subtraction operation.
-}</span><span>
</span><span id="line-637"></span><span>
</span><span id="line-638"></span><span class="hs-comment">-- See Note [NPlusK patterns]</span><span>
</span><span id="line-639"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#NPlusKPat"><span class="hs-identifier hs-type">NPlusKPat</span></a></span><span> </span><span class="annot"><span class="annottext">XNPlusKPat GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681121526"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121526"><span class="hs-identifier hs-var">nm_loc</span></a></span></span><span> </span><span id="local-6989586621681121525"><span class="annot"><span class="annottext">IdP GhcRn
</span><a href="#local-6989586621681121525"><span class="hs-identifier hs-var">name</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-640"></span><span>               </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681121524"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121524"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621681121523"><span class="annot"><span class="annottext">HsOverLit GhcRn
</span><a href="#local-6989586621681121523"><span class="hs-identifier hs-var">lit</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">HsOverLit GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681121522"><span class="annot"><span class="annottext">SyntaxExpr GhcRn
</span><a href="#local-6989586621681121522"><span class="hs-identifier hs-var">ge</span></a></span></span><span> </span><span id="local-6989586621681121521"><span class="annot"><span class="annottext">SyntaxExpr GhcRn
</span><a href="#local-6989586621681121521"><span class="hs-identifier hs-var">minus</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-641"></span><span>        </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121520"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121520"><span class="hs-identifier hs-var">mult_wrap</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; TcM HsWrapper
forall a. Scaled a -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Gen.Pat.html#checkManyPattern"><span class="hs-identifier hs-var">checkManyPattern</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-642"></span><span>            </span><span class="hs-comment">-- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify.</span><span>
</span><span id="line-643"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121519"><span class="annot"><span class="annottext">pat_exp_ty :: ExpSigmaType
</span><a href="#local-6989586621681121519"><span class="hs-identifier hs-var hs-var">pat_exp_ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-644"></span><span>              </span><span id="local-6989586621681121518"><span class="annot"><span class="annottext">orig :: CtOrigin
</span><a href="#local-6989586621681121518"><span class="hs-identifier hs-var hs-var">orig</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsOverLit GhcRn -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Origin.html#LiteralOrigin"><span class="hs-identifier hs-var">LiteralOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">HsOverLit GhcRn
</span><a href="#local-6989586621681121523"><span class="hs-identifier hs-var">lit</span></a></span><span>
</span><span id="line-645"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121517"><span class="annot"><span class="annottext">HsOverLit GhcTc
</span><a href="#local-6989586621681121517"><span class="hs-identifier hs-var">lit1'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121516"><span class="annot"><span class="annottext">SyntaxExprTc
</span><a href="#local-6989586621681121516"><span class="hs-identifier hs-var">ge'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-646"></span><span>            </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CtOrigin
-&gt; SyntaxExprRn
-&gt; [SyntaxOpType]
-&gt; ExpSigmaType
-&gt; ([TcType] -&gt; [TcType] -&gt; TcM (HsOverLit GhcTc))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (HsOverLit GhcTc, SyntaxExprTc)
forall a.
CtOrigin
-&gt; SyntaxExprRn
-&gt; [SyntaxOpType]
-&gt; ExpSigmaType
-&gt; ([TcType] -&gt; [TcType] -&gt; TcM a)
-&gt; TcM (a, SyntaxExprTc)
</span><a href="GHC.Tc.Gen.Expr.html#tcSyntaxOp"><span class="hs-identifier hs-var">tcSyntaxOp</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621681121518"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="annot"><span class="annottext">SyntaxExpr GhcRn
SyntaxExprRn
</span><a href="#local-6989586621681121522"><span class="hs-identifier hs-var">ge</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ExpSigmaType -&gt; SyntaxOpType
</span><a href="GHC.Tc.Utils.TcType.html#SynType"><span class="hs-identifier hs-var">SynType</span></a></span><span> </span><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681121519"><span class="hs-identifier hs-var">pat_exp_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SyntaxOpType
</span><a href="GHC.Tc.Utils.TcType.html#SynRho"><span class="hs-identifier hs-var">SynRho</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-647"></span><span>                                  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="GHC.Builtin.Types.html#boolTy"><span class="hs-identifier hs-var">boolTy</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(([TcType] -&gt; [TcType] -&gt; TcM (HsOverLit GhcTc))
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) (HsOverLit GhcTc, SyntaxExprTc))
-&gt; ([TcType] -&gt; [TcType] -&gt; TcM (HsOverLit GhcTc))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (HsOverLit GhcTc, SyntaxExprTc)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-648"></span><span>               </span><span class="hs-glyph">\</span><span> </span><span class="hs-special">[</span><span id="local-6989586621681121515"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121515"><span class="hs-identifier hs-var">lit1_ty</span></a></span></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-649"></span><span>               </span><span class="annot"><span class="annottext">HsOverLit GhcRn -&gt; ExpSigmaType -&gt; TcM (HsOverLit GhcTc)
</span><a href="GHC.Tc.Utils.Instantiate.html#newOverloadedLit"><span class="hs-identifier hs-var">newOverloadedLit</span></a></span><span> </span><span class="annot"><span class="annottext">HsOverLit GhcRn
</span><a href="#local-6989586621681121523"><span class="hs-identifier hs-var">lit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121515"><span class="hs-identifier hs-var">lit1_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-650"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621681121514"><span class="annot"><span class="annottext">HsOverLit GhcTc
</span><a href="#local-6989586621681121514"><span class="hs-identifier hs-var">lit2'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121513"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121513"><span class="hs-identifier hs-var">minus_wrap</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121512"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121512"><span class="hs-identifier hs-var">bndr_id</span></a></span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121511"><span class="annot"><span class="annottext">SyntaxExprTc
</span><a href="#local-6989586621681121511"><span class="hs-identifier hs-var">minus'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-651"></span><span>            </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CtOrigin
-&gt; SyntaxExprRn
-&gt; [SyntaxOpType]
-&gt; SyntaxOpType
-&gt; ([TcType]
    -&gt; [TcType] -&gt; TcM (HsOverLit GhcTc, HsWrapper, TyVar))
-&gt; TcM ((HsOverLit GhcTc, HsWrapper, TyVar), SyntaxExprTc)
forall a.
CtOrigin
-&gt; SyntaxExprRn
-&gt; [SyntaxOpType]
-&gt; SyntaxOpType
-&gt; ([TcType] -&gt; [TcType] -&gt; TcM a)
-&gt; TcM (a, SyntaxExprTc)
</span><a href="GHC.Tc.Gen.Expr.html#tcSyntaxOpGen"><span class="hs-identifier hs-var">tcSyntaxOpGen</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621681121518"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="annot"><span class="annottext">SyntaxExpr GhcRn
SyntaxExprRn
</span><a href="#local-6989586621681121521"><span class="hs-identifier hs-var">minus</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ExpSigmaType -&gt; SyntaxOpType
</span><a href="GHC.Tc.Utils.TcType.html#SynType"><span class="hs-identifier hs-var">SynType</span></a></span><span> </span><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681121519"><span class="hs-identifier hs-var">pat_exp_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SyntaxOpType
</span><a href="GHC.Tc.Utils.TcType.html#SynRho"><span class="hs-identifier hs-var">SynRho</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">SyntaxOpType
</span><a href="GHC.Tc.Utils.TcType.html#SynAny"><span class="hs-identifier hs-var">SynAny</span></a></span><span> </span><span class="annot"><span class="annottext">(([TcType] -&gt; [TcType] -&gt; TcM (HsOverLit GhcTc, HsWrapper, TyVar))
 -&gt; TcM ((HsOverLit GhcTc, HsWrapper, TyVar), SyntaxExprTc))
-&gt; ([TcType]
    -&gt; [TcType] -&gt; TcM (HsOverLit GhcTc, HsWrapper, TyVar))
-&gt; TcM ((HsOverLit GhcTc, HsWrapper, TyVar), SyntaxExprTc)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-652"></span><span>               </span><span class="hs-glyph">\</span><span> </span><span class="hs-special">[</span><span id="local-6989586621681121510"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121510"><span class="hs-identifier hs-var">lit2_ty</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121509"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121509"><span class="hs-identifier hs-var">var_ty</span></a></span></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-653"></span><span>               </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121508"><span class="annot"><span class="annottext">HsOverLit GhcTc
</span><a href="#local-6989586621681121508"><span class="hs-identifier hs-var">lit2'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HsOverLit GhcRn -&gt; ExpSigmaType -&gt; TcM (HsOverLit GhcTc)
</span><a href="GHC.Tc.Utils.Instantiate.html#newOverloadedLit"><span class="hs-identifier hs-var">newOverloadedLit</span></a></span><span> </span><span class="annot"><span class="annottext">HsOverLit GhcRn
</span><a href="#local-6989586621681121523"><span class="hs-identifier hs-var">lit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121510"><span class="hs-identifier hs-var">lit2_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-654"></span><span>                  </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121507"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121507"><span class="hs-identifier hs-var">wrap</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121506"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121506"><span class="hs-identifier hs-var">bndr_id</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; TcM (HsWrapper, TyVar) -&gt; TcM (HsWrapper, TyVar)
forall a. SrcSpan -&gt; TcRn a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#setSrcSpan"><span class="hs-identifier hs-var">setSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121526"><span class="hs-identifier hs-var">nm_loc</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM (HsWrapper, TyVar) -&gt; TcM (HsWrapper, TyVar))
-&gt; TcM (HsWrapper, TyVar) -&gt; TcM (HsWrapper, TyVar)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-655"></span><span>                                     </span><span class="annot"><span class="annottext">PatEnv -&gt; Name -&gt; Scaled ExpSigmaType -&gt; TcM (HsWrapper, TyVar)
</span><a href="GHC.Tc.Gen.Pat.html#tcPatBndr"><span class="hs-identifier hs-var">tcPatBndr</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP GhcRn
</span><a href="#local-6989586621681121525"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ExpSigmaType -&gt; Scaled ExpSigmaType
forall a. a -&gt; Scaled a
</span><a href="GHC.Core.Type.html#unrestricted"><span class="hs-identifier hs-var">unrestricted</span></a></span><span> </span><span class="annot"><span class="annottext">(ExpSigmaType -&gt; Scaled ExpSigmaType)
-&gt; ExpSigmaType -&gt; Scaled ExpSigmaType
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121509"><span class="hs-identifier hs-var">var_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-656"></span><span>                           </span><span class="hs-comment">-- co :: var_ty ~ idType bndr_id</span><span>
</span><span id="line-657"></span><span>
</span><span id="line-658"></span><span>                           </span><span class="hs-comment">-- minus_wrap is applicable to minus'</span><span>
</span><span id="line-659"></span><span>                  </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(HsOverLit GhcTc, HsWrapper, TyVar)
-&gt; TcM (HsOverLit GhcTc, HsWrapper, TyVar)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsOverLit GhcTc
</span><a href="#local-6989586621681121508"><span class="hs-identifier hs-var">lit2'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121507"><span class="hs-identifier hs-var">wrap</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121506"><span class="hs-identifier hs-var">bndr_id</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-660"></span><span>
</span><span id="line-661"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121505"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121505"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#readExpType"><span class="hs-identifier hs-var">readExpType</span></a></span><span> </span><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681121519"><span class="hs-identifier hs-var">pat_exp_ty</span></a></span><span>
</span><span id="line-662"></span><span>        </span><span class="hs-comment">-- The Report says that n+k patterns must be in Integral</span><span>
</span><span id="line-663"></span><span>        </span><span class="hs-comment">-- but it's silly to insist on this in the RebindableSyntax case</span><span>
</span><span id="line-664"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) Bool -&gt; TcRn () -&gt; TcRn ()
forall (m :: * -&gt; *). Monad m =&gt; m Bool -&gt; m () -&gt; m ()
</span><a href="GHC.Utils.Monad.html#unlessM"><span class="hs-identifier hs-var">unlessM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Extension -&gt; IOEnv (Env TcGblEnv TcLclEnv) Bool
forall gbl lcl. Extension -&gt; TcRnIf gbl lcl Bool
</span><a href="GHC.Tc.Utils.Monad.html#xoptM"><span class="hs-identifier hs-var">xoptM</span></a></span><span> </span><span class="annot"><span class="annottext">Extension
</span><a href="../../ghc-boot-th/src/GHC.LanguageExtensions.Type.html#RebindableSyntax"><span class="hs-identifier hs-var">LangExt.RebindableSyntax</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcRn () -&gt; TcRn ()) -&gt; TcRn () -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-665"></span><span>          </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121501"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681121501"><span class="hs-identifier hs-var">icls</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM Class
</span><a href="GHC.Tc.Utils.Env.html#tcLookupClass"><span class="hs-identifier hs-var">tcLookupClass</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#integralClassName"><span class="hs-identifier hs-var">integralClassName</span></a></span><span>
</span><span id="line-666"></span><span>             </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CtOrigin -&gt; [TcType] -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Instantiate.html#instStupidTheta"><span class="hs-identifier hs-var">instStupidTheta</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621681121518"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Class -&gt; [TcType] -&gt; TcType
</span><a href="GHC.Core.Predicate.html#mkClassPred"><span class="hs-identifier hs-var">mkClassPred</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681121501"><span class="hs-identifier hs-var">icls</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121505"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-667"></span><span>
</span><span id="line-668"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121496"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121496"><span class="hs-identifier hs-var">res</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TyVar -&gt; TcM r -&gt; TcM r
forall a. Name -&gt; TyVar -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Env.html#tcExtendIdEnv1"><span class="hs-identifier hs-var">tcExtendIdEnv1</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP GhcRn
</span><a href="#local-6989586621681121525"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121512"><span class="hs-identifier hs-var">bndr_id</span></a></span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-669"></span><span>
</span><span id="line-670"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121495"><span class="annot"><span class="annottext">minus'' :: SyntaxExprTc
</span><a href="#local-6989586621681121495"><span class="hs-identifier hs-var hs-var">minus''</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">SyntaxExprTc
</span><a href="#local-6989586621681121511"><span class="hs-identifier hs-var">minus'</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-671"></span><span>                          </span><span class="annot"><span class="annottext">SyntaxExprTc
</span><a href="GHC.Hs.Expr.html#NoSyntaxExprTc"><span class="hs-identifier hs-var">NoSyntaxExprTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; SyntaxExprTc
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tc_pat NoSyntaxExprTc&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SyntaxExprTc -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">SyntaxExprTc
</span><a href="#local-6989586621681121511"><span class="hs-identifier hs-var">minus'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-672"></span><span>                                   </span><span class="hs-comment">-- this should be statically avoidable</span><span>
</span><span id="line-673"></span><span>                                   </span><span class="hs-comment">-- Case (3) from Note [NoSyntaxExpr] in &quot;GHC.Hs.Expr&quot;</span><span>
</span><span id="line-674"></span><span>                          </span><span class="annot"><a href="GHC.Hs.Expr.html#SyntaxExprTc"><span class="hs-identifier hs-type">SyntaxExprTc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">syn_expr :: SyntaxExprTc -&gt; HsExpr GhcTc
</span><a href="GHC.Hs.Expr.html#syn_expr"><span class="hs-identifier hs-var">syn_expr</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681121490"><span class="annot"><span class="annottext">HsExpr GhcTc
</span><a href="#local-6989586621681121490"><span class="hs-identifier hs-var">minus'_expr</span></a></span></span><span>
</span><span id="line-675"></span><span>                                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">syn_arg_wraps :: SyntaxExprTc -&gt; [HsWrapper]
</span><a href="GHC.Hs.Expr.html#syn_arg_wraps"><span class="hs-identifier hs-var">syn_arg_wraps</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681121488"><span class="annot"><span class="annottext">[HsWrapper]
</span><a href="#local-6989586621681121488"><span class="hs-identifier hs-var">minus'_arg_wraps</span></a></span></span><span>
</span><span id="line-676"></span><span>                                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">syn_res_wrap :: SyntaxExprTc -&gt; HsWrapper
</span><a href="GHC.Hs.Expr.html#syn_res_wrap"><span class="hs-identifier hs-var">syn_res_wrap</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681121486"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121486"><span class="hs-identifier hs-var">minus'_res_wrap</span></a></span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-677"></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SyntaxExprTc :: HsExpr GhcTc -&gt; [HsWrapper] -&gt; HsWrapper -&gt; SyntaxExprTc
</span><a href="GHC.Hs.Expr.html#SyntaxExprTc"><span class="hs-identifier hs-type">SyntaxExprTc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">syn_expr :: HsExpr GhcTc
</span><a href="GHC.Hs.Expr.html#syn_expr"><span class="hs-identifier hs-var">syn_expr</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsExpr GhcTc
</span><a href="#local-6989586621681121490"><span class="hs-identifier hs-var">minus'_expr</span></a></span><span>
</span><span id="line-678"></span><span>                                            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">syn_arg_wraps :: [HsWrapper]
</span><a href="GHC.Hs.Expr.html#syn_arg_wraps"><span class="hs-identifier hs-var">syn_arg_wraps</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[HsWrapper]
</span><a href="#local-6989586621681121488"><span class="hs-identifier hs-var">minus'_arg_wraps</span></a></span><span>
</span><span id="line-679"></span><span>                                            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">syn_res_wrap :: HsWrapper
</span><a href="GHC.Hs.Expr.html#syn_res_wrap"><span class="hs-identifier hs-var">syn_res_wrap</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121513"><span class="hs-identifier hs-var">minus_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper -&gt; HsWrapper -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121486"><span class="hs-identifier hs-var">minus'_res_wrap</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-680"></span><span>                             </span><span class="hs-comment">-- Oy. This should really be a record update, but</span><span>
</span><span id="line-681"></span><span>                             </span><span class="hs-comment">-- we get warnings if we try. #17783</span><span>
</span><span id="line-682"></span><span>              </span><span id="local-6989586621681121485"><span class="annot"><span class="annottext">pat' :: Pat GhcTc
</span><a href="#local-6989586621681121485"><span class="hs-identifier hs-var hs-var">pat'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XNPlusKPat GhcTc
-&gt; Located (IdP GhcTc)
-&gt; Located (HsOverLit GhcTc)
-&gt; HsOverLit GhcTc
-&gt; SyntaxExpr GhcTc
-&gt; SyntaxExpr GhcTc
-&gt; Pat GhcTc
forall p.
XNPlusKPat p
-&gt; Located (IdP p)
-&gt; Located (HsOverLit p)
-&gt; HsOverLit p
-&gt; SyntaxExpr p
-&gt; SyntaxExpr p
-&gt; Pat p
</span><a href="GHC.Hs.Pat.html#NPlusKPat"><span class="hs-identifier hs-var">NPlusKPat</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
XNPlusKPat GhcTc
</span><a href="#local-6989586621681121505"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; TyVar -&gt; GenLocated SrcSpan TyVar
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121526"><span class="hs-identifier hs-var">nm_loc</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121512"><span class="hs-identifier hs-var">bndr_id</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; HsOverLit GhcTc -&gt; Located (HsOverLit GhcTc)
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121524"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">HsOverLit GhcTc
</span><a href="#local-6989586621681121517"><span class="hs-identifier hs-var">lit1'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">HsOverLit GhcTc
</span><a href="#local-6989586621681121514"><span class="hs-identifier hs-var">lit2'</span></a></span><span>
</span><span id="line-683"></span><span>                               </span><span class="annot"><span class="annottext">SyntaxExpr GhcTc
SyntaxExprTc
</span><a href="#local-6989586621681121516"><span class="hs-identifier hs-var">ge'</span></a></span><span> </span><span class="annot"><span class="annottext">SyntaxExpr GhcTc
SyntaxExprTc
</span><a href="#local-6989586621681121495"><span class="hs-identifier hs-var">minus''</span></a></span><span>
</span><span id="line-684"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Pat GhcTc, r) -&gt; TcM (Pat GhcTc, r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper -&gt; Pat GhcTc -&gt; TcType -&gt; Pat GhcTc
</span><a href="GHC.Hs.Utils.html#mkHsWrapPat"><span class="hs-identifier hs-var">mkHsWrapPat</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121520"><span class="hs-identifier hs-var">mult_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">Pat GhcTc
</span><a href="#local-6989586621681121485"><span class="hs-identifier hs-var">pat'</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121505"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121496"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-685"></span><span>
</span><span id="line-686"></span><span class="hs-comment">-- HsSpliced is an annotation produced by 'GHC.Rename.Splice.rnSplicePat'.</span><span>
</span><span id="line-687"></span><span class="hs-comment">-- Here we get rid of it and add the finalizers to the global environment.</span><span>
</span><span id="line-688"></span><span class="hs-comment">--</span><span>
</span><span id="line-689"></span><span class="hs-comment">-- See Note [Delaying modFinalizers in untyped splices] in GHC.Rename.Splice.</span><span>
</span><span id="line-690"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#SplicePat"><span class="hs-identifier hs-type">SplicePat</span></a></span><span> </span><span class="annot"><span class="annottext">XSplicePat GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681121483"><span class="annot"><span class="annottext">HsSplice GhcRn
</span><a href="#local-6989586621681121483"><span class="hs-identifier hs-var">splice</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HsSplice GhcRn
</span><a href="#local-6989586621681121483"><span class="hs-identifier hs-var">splice</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-691"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#HsSpliced"><span class="hs-identifier hs-type">HsSpliced</span></a></span><span> </span><span class="annot"><span class="annottext">XSpliced GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681121481"><span class="annot"><span class="annottext">ThModFinalizers
</span><a href="#local-6989586621681121481"><span class="hs-identifier hs-var">mod_finalizers</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#HsSplicedPat"><span class="hs-identifier hs-type">HsSplicedPat</span></a></span><span> </span><span id="local-6989586621681121479"><span class="annot"><span class="annottext">Pat GhcRn
</span><a href="#local-6989586621681121479"><span class="hs-identifier hs-var">pat</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-692"></span><span>      </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ThModFinalizers -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#addModFinalizersWithLclEnv"><span class="hs-identifier hs-var">addModFinalizersWithLclEnv</span></a></span><span> </span><span class="annot"><span class="annottext">ThModFinalizers
</span><a href="#local-6989586621681121481"><span class="hs-identifier hs-var">mod_finalizers</span></a></span><span>
</span><span id="line-693"></span><span>      </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; Checker (Pat GhcRn) (Pat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_pat"><span class="hs-identifier hs-var">tc_pat</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121722"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121721"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">Pat GhcRn
</span><a href="#local-6989586621681121479"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121719"><span class="hs-identifier hs-var">thing_inside</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-694"></span><span>    </span><span class="annot"><span class="annottext">HsSplice GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; TcM (Pat GhcTc, r)
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;invalid splice in splice pat&quot;</span></span><span>
</span><span id="line-695"></span><span>
</span><span id="line-696"></span><span>
</span><span id="line-697"></span><span class="hs-comment">{-
Note [Hopping the LIE in lazy patterns]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In a lazy pattern, we must *not* discharge constraints from the RHS
from dictionaries bound in the pattern.  E.g.
        f ~(C x) = 3
We can't discharge the Num constraint from dictionaries bound by
the pattern C!

So we have to make the constraints from thing_inside &quot;hop around&quot;
the pattern.  Hence the captureConstraints and emitConstraints.

The same thing ensures that equality constraints in a lazy match
are not made available in the RHS of the match. For example
        data T a where { T1 :: Int -&gt; T Int; ... }
        f :: T a -&gt; Int -&gt; a
        f ~(T1 i) y = y
It's obviously not sound to refine a to Int in the right
hand side, because the argument might not match T1 at all!

Finally, a lazy pattern should not bind any existential type variables
because they won't be in scope when we do the desugaring


************************************************************************
*                                                                      *
            Pattern signatures   (pat :: type)
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-727"></span><span>
</span><span id="line-728"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcPatSig"><span class="hs-identifier hs-type">tcPatSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>                    </span><span class="hs-comment">-- True &lt;=&gt; pattern binding</span><span>
</span><span id="line-729"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Type.html#HsPatSigType"><span class="hs-identifier hs-type">HsPatSigType</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span>
</span><span id="line-730"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpSigmaType"><span class="hs-identifier hs-type">ExpSigmaType</span></a></span><span>
</span><span id="line-731"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- The type to use for &quot;inside&quot; the signature</span><span>
</span><span id="line-732"></span><span>                 </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span>  </span><span class="hs-comment">-- The new bit of type environment, binding</span><span>
</span><span id="line-733"></span><span>                                    </span><span class="hs-comment">-- the scoped type variables</span><span>
</span><span id="line-734"></span><span>                 </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span>  </span><span class="hs-comment">-- The wildcards</span><span>
</span><span id="line-735"></span><span>                 </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#HsWrapper"><span class="hs-identifier hs-type">HsWrapper</span></a></span><span class="hs-special">)</span><span>         </span><span class="hs-comment">-- Coercion due to unification with actual ty</span><span>
</span><span id="line-736"></span><span>                                    </span><span class="hs-comment">-- Of shape:  res_ty ~ sig_ty</span><span>
</span><span id="line-737"></span><span id="tcPatSig"><span class="annot"><span class="annottext">tcPatSig :: Bool
-&gt; HsPatSigType GhcRn
-&gt; ExpSigmaType
-&gt; TcM (TcType, [(Name, TyVar)], [(Name, TyVar)], HsWrapper)
</span><a href="GHC.Tc.Gen.Pat.html#tcPatSig"><span class="hs-identifier hs-var hs-var">tcPatSig</span></a></span></span><span> </span><span id="local-6989586621681121475"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681121475"><span class="hs-identifier hs-var">in_pat_bind</span></a></span></span><span> </span><span id="local-6989586621681121474"><span class="annot"><span class="annottext">HsPatSigType GhcRn
</span><a href="#local-6989586621681121474"><span class="hs-identifier hs-var">sig</span></a></span></span><span> </span><span id="local-6989586621681121473"><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681121473"><span class="hs-identifier hs-var">res_ty</span></a></span></span><span>
</span><span id="line-738"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121472"><span class="annot"><span class="annottext">[(Name, TyVar)]
</span><a href="#local-6989586621681121472"><span class="hs-identifier hs-var">sig_wcs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121471"><span class="annot"><span class="annottext">[(Name, TyVar)]
</span><a href="#local-6989586621681121471"><span class="hs-identifier hs-var">sig_tvs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121470"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121470"><span class="hs-identifier hs-var">sig_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">UserTypeCtxt
-&gt; HsPatSigType GhcRn
-&gt; TcM ([(Name, TyVar)], [(Name, TyVar)], TcType)
</span><a href="GHC.Tc.Gen.HsType.html#tcHsPatSigType"><span class="hs-identifier hs-var">tcHsPatSigType</span></a></span><span> </span><span class="annot"><span class="annottext">UserTypeCtxt
</span><a href="GHC.Tc.Types.Origin.html#PatSigCtxt"><span class="hs-identifier hs-var">PatSigCtxt</span></a></span><span> </span><span class="annot"><span class="annottext">HsPatSigType GhcRn
</span><a href="#local-6989586621681121474"><span class="hs-identifier hs-var">sig</span></a></span><span>
</span><span id="line-739"></span><span>        </span><span class="hs-comment">-- sig_tvs are the type variables free in 'sig',</span><span>
</span><span id="line-740"></span><span>        </span><span class="hs-comment">-- and not already in scope. These are the ones</span><span>
</span><span id="line-741"></span><span>        </span><span class="hs-comment">-- that should be brought into scope</span><span>
</span><span id="line-742"></span><span>
</span><span id="line-743"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[(Name, TyVar)] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, TyVar)]
</span><a href="#local-6989586621681121471"><span class="hs-identifier hs-var">sig_tvs</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-744"></span><span>                </span><span class="hs-comment">-- Just do the subsumption check and return</span><span>
</span><span id="line-745"></span><span>                  </span><span id="local-6989586621681121466"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121466"><span class="hs-identifier hs-var">wrap</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(TidyEnv -&gt; TcM (TidyEnv, SDoc)) -&gt; TcM HsWrapper -&gt; TcM HsWrapper
forall a. (TidyEnv -&gt; TcM (TidyEnv, SDoc)) -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#addErrCtxtM"><span class="hs-identifier hs-var">addErrCtxtM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; TidyEnv -&gt; TcM (TidyEnv, SDoc)
</span><a href="#local-6989586621681121464"><span class="hs-identifier hs-var">mk_msg</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121470"><span class="hs-identifier hs-var">sig_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcM HsWrapper -&gt; TcM HsWrapper) -&gt; TcM HsWrapper -&gt; TcM HsWrapper
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-746"></span><span>                          </span><span class="annot"><span class="annottext">CtOrigin -&gt; UserTypeCtxt -&gt; ExpSigmaType -&gt; TcType -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Utils.Unify.html#tcSubTypePat"><span class="hs-identifier hs-var">tcSubTypePat</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="GHC.Tc.Types.Origin.html#PatSigOrigin"><span class="hs-identifier hs-var">PatSigOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">UserTypeCtxt
</span><a href="GHC.Tc.Types.Origin.html#PatSigCtxt"><span class="hs-identifier hs-var">PatSigCtxt</span></a></span><span> </span><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681121473"><span class="hs-identifier hs-var">res_ty</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121470"><span class="hs-identifier hs-var">sig_ty</span></a></span><span>
</span><span id="line-747"></span><span>                </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(TcType, [(Name, TyVar)], [(Name, TyVar)], HsWrapper)
-&gt; TcM (TcType, [(Name, TyVar)], [(Name, TyVar)], HsWrapper)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121470"><span class="hs-identifier hs-var">sig_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(Name, TyVar)]
</span><a href="#local-6989586621681121472"><span class="hs-identifier hs-var">sig_wcs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121466"><span class="hs-identifier hs-var">wrap</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-748"></span><span>        </span><span class="hs-special">}</span><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-749"></span><span>                </span><span class="hs-comment">-- Type signature binds at least one scoped type variable</span><span>
</span><span id="line-750"></span><span>
</span><span id="line-751"></span><span>                </span><span class="hs-comment">-- A pattern binding cannot bind scoped type variables</span><span>
</span><span id="line-752"></span><span>                </span><span class="hs-comment">-- It is more convenient to make the test here</span><span>
</span><span id="line-753"></span><span>                </span><span class="hs-comment">-- than in the renamer</span><span>
</span><span id="line-754"></span><span>        </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; TcRn () -&gt; TcRn ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681121475"><span class="hs-identifier hs-var">in_pat_bind</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#addErr"><span class="hs-identifier hs-var">addErr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(Name, TyVar)] -&gt; SDoc
</span><a href="GHC.Tc.Gen.Pat.html#patBindSigErr"><span class="hs-identifier hs-var">patBindSigErr</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, TyVar)]
</span><a href="#local-6989586621681121471"><span class="hs-identifier hs-var">sig_tvs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-755"></span><span>
</span><span id="line-756"></span><span>        </span><span class="hs-comment">-- Now do a subsumption check of the pattern signature against res_ty</span><span>
</span><span id="line-757"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121460"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121460"><span class="hs-identifier hs-var">wrap</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(TidyEnv -&gt; TcM (TidyEnv, SDoc)) -&gt; TcM HsWrapper -&gt; TcM HsWrapper
forall a. (TidyEnv -&gt; TcM (TidyEnv, SDoc)) -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#addErrCtxtM"><span class="hs-identifier hs-var">addErrCtxtM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; TidyEnv -&gt; TcM (TidyEnv, SDoc)
</span><a href="#local-6989586621681121464"><span class="hs-identifier hs-var">mk_msg</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121470"><span class="hs-identifier hs-var">sig_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcM HsWrapper -&gt; TcM HsWrapper) -&gt; TcM HsWrapper -&gt; TcM HsWrapper
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-758"></span><span>                  </span><span class="annot"><span class="annottext">CtOrigin -&gt; UserTypeCtxt -&gt; ExpSigmaType -&gt; TcType -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Utils.Unify.html#tcSubTypePat"><span class="hs-identifier hs-var">tcSubTypePat</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="GHC.Tc.Types.Origin.html#PatSigOrigin"><span class="hs-identifier hs-var">PatSigOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">UserTypeCtxt
</span><a href="GHC.Tc.Types.Origin.html#PatSigCtxt"><span class="hs-identifier hs-var">PatSigCtxt</span></a></span><span> </span><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681121473"><span class="hs-identifier hs-var">res_ty</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121470"><span class="hs-identifier hs-var">sig_ty</span></a></span><span>
</span><span id="line-759"></span><span>
</span><span id="line-760"></span><span>        </span><span class="hs-comment">-- Phew!</span><span>
</span><span id="line-761"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(TcType, [(Name, TyVar)], [(Name, TyVar)], HsWrapper)
-&gt; TcM (TcType, [(Name, TyVar)], [(Name, TyVar)], HsWrapper)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121470"><span class="hs-identifier hs-var">sig_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(Name, TyVar)]
</span><a href="#local-6989586621681121471"><span class="hs-identifier hs-var">sig_tvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(Name, TyVar)]
</span><a href="#local-6989586621681121472"><span class="hs-identifier hs-var">sig_wcs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121460"><span class="hs-identifier hs-var">wrap</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-762"></span><span>        </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-763"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-764"></span><span>    </span><span id="local-6989586621681121464"><span class="annot"><span class="annottext">mk_msg :: TcType -&gt; TidyEnv -&gt; TcM (TidyEnv, SDoc)
</span><a href="#local-6989586621681121464"><span class="hs-identifier hs-var hs-var">mk_msg</span></a></span></span><span> </span><span id="local-6989586621681121459"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121459"><span class="hs-identifier hs-var">sig_ty</span></a></span></span><span> </span><span id="local-6989586621681121458"><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681121458"><span class="hs-identifier hs-var">tidy_env</span></a></span></span><span>
</span><span id="line-765"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121457"><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681121457"><span class="hs-identifier hs-var">tidy_env</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121456"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121456"><span class="hs-identifier hs-var">sig_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TidyEnv -&gt; TcType -&gt; TcM (TidyEnv, TcType)
</span><a href="GHC.Tc.Utils.TcMType.html#zonkTidyTcType"><span class="hs-identifier hs-var">zonkTidyTcType</span></a></span><span> </span><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681121458"><span class="hs-identifier hs-var">tidy_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121459"><span class="hs-identifier hs-var">sig_ty</span></a></span><span>
</span><span id="line-766"></span><span>            </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121454"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121454"><span class="hs-identifier hs-var">res_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#readExpType"><span class="hs-identifier hs-var">readExpType</span></a></span><span> </span><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681121473"><span class="hs-identifier hs-var">res_ty</span></a></span><span>   </span><span class="hs-comment">-- should be filled in by now</span><span>
</span><span id="line-767"></span><span>            </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121453"><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681121453"><span class="hs-identifier hs-var">tidy_env</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121452"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121452"><span class="hs-identifier hs-var">res_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TidyEnv -&gt; TcType -&gt; TcM (TidyEnv, TcType)
</span><a href="GHC.Tc.Utils.TcMType.html#zonkTidyTcType"><span class="hs-identifier hs-var">zonkTidyTcType</span></a></span><span> </span><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681121457"><span class="hs-identifier hs-var">tidy_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121454"><span class="hs-identifier hs-var">res_ty</span></a></span><span>
</span><span id="line-768"></span><span>            </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121451"><span class="annot"><span class="annottext">msg :: SDoc
</span><a href="#local-6989586621681121451"><span class="hs-identifier hs-var hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;When checking that the pattern signature:&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-769"></span><span>                                  </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121456"><span class="hs-identifier hs-var">sig_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-770"></span><span>                             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#nest"><span class="hs-identifier hs-var">nest</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;fits the type of its context:&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-771"></span><span>                                          </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121452"><span class="hs-identifier hs-var">res_ty</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-772"></span><span>            </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(TidyEnv, SDoc) -&gt; TcM (TidyEnv, SDoc)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681121453"><span class="hs-identifier hs-var">tidy_env</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681121451"><span class="hs-identifier hs-var">msg</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-773"></span><span>
</span><span id="line-774"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#patBindSigErr"><span class="hs-identifier hs-type">patBindSigErr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-775"></span><span id="patBindSigErr"><span class="annot"><span class="annottext">patBindSigErr :: [(Name, TyVar)] -&gt; SDoc
</span><a href="GHC.Tc.Gen.Pat.html#patBindSigErr"><span class="hs-identifier hs-var hs-var">patBindSigErr</span></a></span></span><span> </span><span id="local-6989586621681121448"><span class="annot"><span class="annottext">[(Name, TyVar)]
</span><a href="#local-6989586621681121448"><span class="hs-identifier hs-var">sig_tvs</span></a></span></span><span>
</span><span id="line-776"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;You cannot bind scoped type variable&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, TyVar)] -&gt; SDoc
forall a. [a] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#plural"><span class="hs-identifier hs-var">plural</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, TyVar)]
</span><a href="#local-6989586621681121448"><span class="hs-identifier hs-var">sig_tvs</span></a></span><span>
</span><span id="line-777"></span><span>          </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[Name] -&gt; SDoc
forall a. Outputable a =&gt; [a] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#pprQuotedList"><span class="hs-identifier hs-var">pprQuotedList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((Name, TyVar) -&gt; Name) -&gt; [(Name, TyVar)] -&gt; [Name]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(Name, TyVar) -&gt; Name
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, TyVar)]
</span><a href="#local-6989586621681121448"><span class="hs-identifier hs-var">sig_tvs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-778"></span><span>       </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;in a pattern binding signature&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-779"></span><span>
</span><span id="line-780"></span><span>
</span><span id="line-781"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
        Most of the work for constructors is here
        (the rest is in the ConPatIn case of tc_pat)
*                                                                      *
************************************************************************

[Pattern matching indexed data types]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider the following declarations:

  data family Map k :: * -&gt; *
  data instance Map (a, b) v = MapPair (Map a (Pair b v))

and a case expression

  case x :: Map (Int, c) w of MapPair m -&gt; ...

As explained by [Wrappers for data instance tycons] in GHC.Types.Id.Make, the
worker/wrapper types for MapPair are

  $WMapPair :: forall a b v. Map a (Map a b v) -&gt; Map (a, b) v
  $wMapPair :: forall a b v. Map a (Map a b v) -&gt; :R123Map a b v

So, the type of the scrutinee is Map (Int, c) w, but the tycon of MapPair is
:R123Map, which means the straight use of boxySplitTyConApp would give a type
error.  Hence, the smart wrapper function boxySplitTyConAppWithFamily calls
boxySplitTyConApp with the family tycon Map instead, which gives us the family
type list {(Int, c), w}.  To get the correct split for :R123Map, we need to
unify the family type list {(Int, c), w} with the instance types {(a, b), v}
(provided by tyConFamInst_maybe together with the family tycon).  This
unification yields the substitution [a -&gt; Int, b -&gt; c, v -&gt; w], which gives us
the split arguments for the representation tycon :R123Map as {Int, c, w}

In other words, boxySplitTyConAppWithFamily implicitly takes the coercion

  Co123Map a b v :: {Map (a, b) v ~ :R123Map a b v}

moving between representation and family type into account.  To produce type
correct Core, this coercion needs to be used to case the type of the scrutinee
from the family to the representation type.  This is achieved by
unwrapFamInstScrutinee using a CoPat around the result pattern.

Now it might appear seem as if we could have used the previous GADT type
refinement infrastructure of refineAlt and friends instead of the explicit
unification and CoPat generation.  However, that would be wrong.  Why?  The
whole point of GADT refinement is that the refinement is local to the case
alternative.  In contrast, the substitution generated by the unification of
the family type list and instance types needs to be propagated to the outside.
Imagine that in the above example, the type of the scrutinee would have been
(Map x w), then we would have unified {x, w} with {(a, b), v}, yielding the
substitution [x -&gt; (a, b), v -&gt; w].  In contrast to GADT matching, the
instantiation of x with (a, b) must be global; ie, it must be valid in *all*
alternatives of the case expression, whereas in the GADT case it might vary
between alternatives.

RIP GADT refinement: refinements have been replaced by the use of explicit
equality constraints that are used in conjunction with implication constraints
to express the local scope of GADT refinements.
-}</span><span>
</span><span id="line-841"></span><span>
</span><span id="line-842"></span><span class="hs-comment">--      Running example:</span><span>
</span><span id="line-843"></span><span class="hs-comment">-- MkT :: forall a b c. (a~[b]) =&gt; b -&gt; c -&gt; T a</span><span>
</span><span id="line-844"></span><span class="hs-comment">--       with scrutinee of type (T ty)</span><span>
</span><span id="line-845"></span><span>
</span><span id="line-846"></span><span id="local-6989586621681122219"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcConPat"><span class="hs-identifier hs-type">tcConPat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PatEnv"><span class="hs-identifier hs-type">PatEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>
</span><span id="line-847"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpSigmaType"><span class="hs-identifier hs-type">ExpSigmaType</span></a></span><span>    </span><span class="hs-comment">-- Type of the pattern</span><span>
</span><span id="line-848"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#HsConPatDetails"><span class="hs-identifier hs-type">HsConPatDetails</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681122219"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-849"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#Pat"><span class="hs-identifier hs-type">Pat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681122219"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-850"></span><span id="tcConPat"><span class="annot"><span class="annottext">tcConPat :: forall a.
PatEnv
-&gt; Located Name
-&gt; Scaled ExpSigmaType
-&gt; HsConPatDetails GhcRn
-&gt; TcM a
-&gt; TcM (Pat GhcTc, a)
</span><a href="GHC.Tc.Gen.Pat.html#tcConPat"><span class="hs-identifier hs-var hs-var">tcConPat</span></a></span></span><span> </span><span id="local-6989586621681121443"><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121443"><span class="hs-identifier hs-var">penv</span></a></span></span><span> </span><span id="local-6989586621681121442"><span class="annot"><span class="annottext">con_lname :: Located Name
</span><a href="#local-6989586621681121442"><span class="hs-identifier hs-var">con_lname</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681121441"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121441"><span class="hs-identifier hs-var">con_name</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681121440"><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121440"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span id="local-6989586621681121439"><span class="annot"><span class="annottext">HsConPatDetails GhcRn
</span><a href="#local-6989586621681121439"><span class="hs-identifier hs-var">arg_pats</span></a></span></span><span> </span><span id="local-6989586621681121438"><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681121438"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-851"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121437"><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681121437"><span class="hs-identifier hs-var">con_like</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM ConLike
</span><a href="GHC.Tc.Utils.Env.html#tcLookupConLike"><span class="hs-identifier hs-var">tcLookupConLike</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121441"><span class="hs-identifier hs-var">con_name</span></a></span><span>
</span><span id="line-852"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681121437"><span class="hs-identifier hs-var">con_like</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-853"></span><span>            </span><span class="annot"><a href="GHC.Core.ConLike.html#RealDataCon"><span class="hs-identifier hs-type">RealDataCon</span></a></span><span> </span><span id="local-6989586621681121434"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681121434"><span class="hs-identifier hs-var">data_con</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">PatEnv
-&gt; Located Name
-&gt; DataCon
-&gt; Scaled ExpSigmaType
-&gt; HsConPatDetails GhcRn
-&gt; TcM a
-&gt; TcM (Pat GhcTc, a)
forall a.
PatEnv
-&gt; Located Name
-&gt; DataCon
-&gt; Scaled ExpSigmaType
-&gt; HsConPatDetails GhcRn
-&gt; TcM a
-&gt; TcM (Pat GhcTc, a)
</span><a href="GHC.Tc.Gen.Pat.html#tcDataConPat"><span class="hs-identifier hs-var">tcDataConPat</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121443"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">Located Name
</span><a href="#local-6989586621681121442"><span class="hs-identifier hs-var">con_lname</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681121434"><span class="hs-identifier hs-var">data_con</span></a></span><span>
</span><span id="line-854"></span><span>                                                 </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121440"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">HsConPatDetails GhcRn
</span><a href="#local-6989586621681121439"><span class="hs-identifier hs-var">arg_pats</span></a></span><span> </span><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681121438"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-855"></span><span>            </span><span class="annot"><a href="GHC.Core.ConLike.html#PatSynCon"><span class="hs-identifier hs-type">PatSynCon</span></a></span><span> </span><span id="local-6989586621681121431"><span class="annot"><span class="annottext">PatSyn
</span><a href="#local-6989586621681121431"><span class="hs-identifier hs-var">pat_syn</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">PatEnv
-&gt; Located Name
-&gt; PatSyn
-&gt; Scaled ExpSigmaType
-&gt; HsConPatDetails GhcRn
-&gt; TcM a
-&gt; TcM (Pat GhcTc, a)
forall a.
PatEnv
-&gt; Located Name
-&gt; PatSyn
-&gt; Scaled ExpSigmaType
-&gt; HsConPatDetails GhcRn
-&gt; TcM a
-&gt; TcM (Pat GhcTc, a)
</span><a href="GHC.Tc.Gen.Pat.html#tcPatSynPat"><span class="hs-identifier hs-var">tcPatSynPat</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121443"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">Located Name
</span><a href="#local-6989586621681121442"><span class="hs-identifier hs-var">con_lname</span></a></span><span> </span><span class="annot"><span class="annottext">PatSyn
</span><a href="#local-6989586621681121431"><span class="hs-identifier hs-var">pat_syn</span></a></span><span>
</span><span id="line-856"></span><span>                                             </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121440"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">HsConPatDetails GhcRn
</span><a href="#local-6989586621681121439"><span class="hs-identifier hs-var">arg_pats</span></a></span><span> </span><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681121438"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-857"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-858"></span><span>
</span><span id="line-859"></span><span id="local-6989586621681122179"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcDataConPat"><span class="hs-identifier hs-type">tcDataConPat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PatEnv"><span class="hs-identifier hs-type">PatEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span>
</span><span id="line-860"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpSigmaType"><span class="hs-identifier hs-type">ExpSigmaType</span></a></span><span>        </span><span class="hs-comment">-- Type of the pattern</span><span>
</span><span id="line-861"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#HsConPatDetails"><span class="hs-identifier hs-type">HsConPatDetails</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681122179"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-862"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#Pat"><span class="hs-identifier hs-type">Pat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681122179"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-863"></span><span id="tcDataConPat"><span class="annot"><span class="annottext">tcDataConPat :: forall a.
PatEnv
-&gt; Located Name
-&gt; DataCon
-&gt; Scaled ExpSigmaType
-&gt; HsConPatDetails GhcRn
-&gt; TcM a
-&gt; TcM (Pat GhcTc, a)
</span><a href="GHC.Tc.Gen.Pat.html#tcDataConPat"><span class="hs-identifier hs-var hs-var">tcDataConPat</span></a></span></span><span> </span><span id="local-6989586621681121385"><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121385"><span class="hs-identifier hs-var">penv</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681121384"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121384"><span class="hs-identifier hs-var">con_span</span></a></span></span><span> </span><span id="local-6989586621681121383"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121383"><span class="hs-identifier hs-var">con_name</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681121382"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681121382"><span class="hs-identifier hs-var">data_con</span></a></span></span><span> </span><span id="local-6989586621681121381"><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121381"><span class="hs-identifier hs-var">pat_ty_scaled</span></a></span></span><span>
</span><span id="line-864"></span><span>             </span><span id="local-6989586621681121380"><span class="annot"><span class="annottext">HsConPatDetails GhcRn
</span><a href="#local-6989586621681121380"><span class="hs-identifier hs-var">arg_pats</span></a></span></span><span> </span><span id="local-6989586621681121379"><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681121379"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-865"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121378"><span class="annot"><span class="annottext">tycon :: TyCon
</span><a href="#local-6989586621681121378"><span class="hs-identifier hs-var hs-var">tycon</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; TyCon
</span><a href="GHC.Core.DataCon.html#dataConTyCon"><span class="hs-identifier hs-var">dataConTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681121382"><span class="hs-identifier hs-var">data_con</span></a></span><span>
</span><span id="line-866"></span><span>                  </span><span class="hs-comment">-- For data families this is the representation tycon</span><span>
</span><span id="line-867"></span><span>              </span><span class="hs-special">(</span><span id="local-6989586621681121376"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121376"><span class="hs-identifier hs-var">univ_tvs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121375"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121375"><span class="hs-identifier hs-var">ex_tvs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121374"><span class="annot"><span class="annottext">[EqSpec]
</span><a href="#local-6989586621681121374"><span class="hs-identifier hs-var">eq_spec</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121373"><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121373"><span class="hs-identifier hs-var">theta</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121372"><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121372"><span class="hs-identifier hs-var">arg_tys</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcType
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-868"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon
-&gt; ([TyVar], [TyVar], [EqSpec], [TcType], [Scaled TcType], TcType)
</span><a href="GHC.Core.DataCon.html#dataConFullSig"><span class="hs-identifier hs-var">dataConFullSig</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681121382"><span class="hs-identifier hs-var">data_con</span></a></span><span>
</span><span id="line-869"></span><span>              </span><span id="local-6989586621681121370"><span class="annot"><span class="annottext">header :: GenLocated SrcSpan ConLike
</span><a href="#local-6989586621681121370"><span class="hs-identifier hs-var hs-var">header</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; ConLike -&gt; GenLocated SrcSpan ConLike
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121384"><span class="hs-identifier hs-var">con_span</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; ConLike
</span><a href="GHC.Core.ConLike.html#RealDataCon"><span class="hs-identifier hs-var">RealDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681121382"><span class="hs-identifier hs-var">data_con</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-870"></span><span>
</span><span id="line-871"></span><span>          </span><span class="hs-comment">-- Instantiate the constructor type variables [a-&gt;ty]</span><span>
</span><span id="line-872"></span><span>          </span><span class="hs-comment">-- This may involve doing a family-instance coercion,</span><span>
</span><span id="line-873"></span><span>          </span><span class="hs-comment">-- and building a wrapper</span><span>
</span><span id="line-874"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121369"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121369"><span class="hs-identifier hs-var">wrap</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121368"><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121368"><span class="hs-identifier hs-var">ctxt_res_tys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">PatEnv -&gt; TyCon -&gt; Scaled ExpSigmaType -&gt; TcM (HsWrapper, [TcType])
</span><a href="GHC.Tc.Gen.Pat.html#matchExpectedConTy"><span class="hs-identifier hs-var">matchExpectedConTy</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121385"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681121378"><span class="hs-identifier hs-var">tycon</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121381"><span class="hs-identifier hs-var">pat_ty_scaled</span></a></span><span>
</span><span id="line-875"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121366"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121366"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#readExpType"><span class="hs-identifier hs-var">readExpType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121381"><span class="hs-identifier hs-var">pat_ty_scaled</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-876"></span><span>
</span><span id="line-877"></span><span>          </span><span class="hs-comment">-- Add the stupid theta</span><span>
</span><span id="line-878"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; TcRn () -&gt; TcRn ()
forall a. SrcSpan -&gt; TcRn a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#setSrcSpan"><span class="hs-identifier hs-var">setSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121384"><span class="hs-identifier hs-var">con_span</span></a></span><span> </span><span class="annot"><span class="annottext">(TcRn () -&gt; TcRn ()) -&gt; TcRn () -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [TcType] -&gt; TcRn ()
</span><a href="GHC.Tc.Gen.Pat.html#addDataConStupidTheta"><span class="hs-identifier hs-var">addDataConStupidTheta</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681121382"><span class="hs-identifier hs-var">data_con</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121368"><span class="hs-identifier hs-var">ctxt_res_tys</span></a></span><span>
</span><span id="line-879"></span><span>
</span><span id="line-880"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121365"><span class="annot"><span class="annottext">all_arg_tys :: [TcType]
</span><a href="#local-6989586621681121365"><span class="hs-identifier hs-var hs-var">all_arg_tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[EqSpec] -&gt; [TcType]
</span><a href="GHC.Core.DataCon.html#eqSpecPreds"><span class="hs-identifier hs-var">eqSpecPreds</span></a></span><span> </span><span class="annot"><span class="annottext">[EqSpec]
</span><a href="#local-6989586621681121374"><span class="hs-identifier hs-var">eq_spec</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType] -&gt; [TcType] -&gt; [TcType]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121373"><span class="hs-identifier hs-var">theta</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType] -&gt; [TcType] -&gt; [TcType]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Scaled TcType -&gt; TcType) -&gt; [Scaled TcType] -&gt; [TcType]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled TcType -&gt; TcType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121372"><span class="hs-identifier hs-var">arg_tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-881"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; [TcType] -&gt; PatEnv -&gt; TcRn ()
</span><a href="GHC.Tc.Gen.Pat.html#checkExistentials"><span class="hs-identifier hs-var">checkExistentials</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121375"><span class="hs-identifier hs-var">ex_tvs</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121365"><span class="hs-identifier hs-var">all_arg_tys</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121385"><span class="hs-identifier hs-var">penv</span></a></span><span>
</span><span id="line-882"></span><span>
</span><span id="line-883"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121362"><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681121362"><span class="hs-identifier hs-var">tenv</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CtOrigin -&gt; [TyVar] -&gt; [TcType] -&gt; TcM TCvSubst
</span><a href="GHC.Tc.Utils.Instantiate.html#instTyVarsWith"><span class="hs-identifier hs-var">instTyVarsWith</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="GHC.Tc.Types.Origin.html#PatOrigin"><span class="hs-identifier hs-var">PatOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121376"><span class="hs-identifier hs-var">univ_tvs</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121368"><span class="hs-identifier hs-var">ctxt_res_tys</span></a></span><span>
</span><span id="line-884"></span><span>                  </span><span class="hs-comment">-- NB: Do not use zipTvSubst!  See #14154</span><span>
</span><span id="line-885"></span><span>                  </span><span class="hs-comment">-- We want to create a well-kinded substitution, so</span><span>
</span><span id="line-886"></span><span>                  </span><span class="hs-comment">-- that the instantiated type is well-kinded</span><span>
</span><span id="line-887"></span><span>
</span><span id="line-888"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121360"><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681121360"><span class="hs-identifier hs-var">tenv</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121359"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121359"><span class="hs-identifier hs-var">ex_tvs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TCvSubst -&gt; [TyVar] -&gt; TcM (TCvSubst, [TyVar])
</span><a href="GHC.Tc.Utils.Instantiate.html#tcInstSuperSkolTyVarsX"><span class="hs-identifier hs-var">tcInstSuperSkolTyVarsX</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681121362"><span class="hs-identifier hs-var">tenv</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121375"><span class="hs-identifier hs-var">ex_tvs</span></a></span><span>
</span><span id="line-889"></span><span>                     </span><span class="hs-comment">-- Get location from monad, not from ex_tvs</span><span>
</span><span id="line-890"></span><span>
</span><span id="line-891"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-comment">-- pat_ty' = mkTyConApp tycon ctxt_res_tys</span><span>
</span><span id="line-892"></span><span>              </span><span class="hs-comment">-- pat_ty' is type of the actual constructor application</span><span>
</span><span id="line-893"></span><span>              </span><span class="hs-comment">-- pat_ty' /= pat_ty iff coi /= IdCo</span><span>
</span><span id="line-894"></span><span>
</span><span id="line-895"></span><span>              </span><span id="local-6989586621681121357"><span class="annot"><span class="annottext">arg_tys' :: [Scaled TcType]
</span><a href="#local-6989586621681121357"><span class="hs-identifier hs-var hs-var">arg_tys'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; [Scaled TcType] -&gt; [Scaled TcType]
TCvSubst -&gt; [Scaled TcType] -&gt; [Scaled TcType]
</span><a href="GHC.Core.TyCo.Subst.html#substScaledTys"><span class="hs-identifier hs-var">substScaledTys</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681121360"><span class="hs-identifier hs-var">tenv</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121372"><span class="hs-identifier hs-var">arg_tys</span></a></span><span>
</span><span id="line-896"></span><span>              </span><span id="local-6989586621681121355"><span class="annot"><span class="annottext">pat_mult :: TcType
</span><a href="#local-6989586621681121355"><span class="hs-identifier hs-var hs-var">pat_mult</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; TcType
forall a. Scaled a -&gt; TcType
</span><a href="GHC.Core.TyCo.Rep.html#scaledMult"><span class="hs-identifier hs-var">scaledMult</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121381"><span class="hs-identifier hs-var">pat_ty_scaled</span></a></span><span>
</span><span id="line-897"></span><span>              </span><span id="local-6989586621681121354"><span class="annot"><span class="annottext">arg_tys_scaled :: [Scaled TcType]
</span><a href="#local-6989586621681121354"><span class="hs-identifier hs-var hs-var">arg_tys_scaled</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Scaled TcType -&gt; Scaled TcType)
-&gt; [Scaled TcType] -&gt; [Scaled TcType]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; Scaled TcType -&gt; Scaled TcType
forall a. TcType -&gt; Scaled a -&gt; Scaled a
</span><a href="GHC.Core.Multiplicity.html#scaleScaled"><span class="hs-identifier hs-var">scaleScaled</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121355"><span class="hs-identifier hs-var">pat_mult</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121357"><span class="hs-identifier hs-var">arg_tys'</span></a></span><span>
</span><span id="line-898"></span><span>
</span><span id="line-899"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcConPat&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121383"><span class="hs-identifier hs-var">con_name</span></a></span><span>
</span><span id="line-900"></span><span>                                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; SDoc
</span><a href="GHC.Core.TyCo.Ppr.html#pprTyVars"><span class="hs-identifier hs-var">pprTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121376"><span class="hs-identifier hs-var">univ_tvs</span></a></span><span>
</span><span id="line-901"></span><span>                                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; SDoc
</span><a href="GHC.Core.TyCo.Ppr.html#pprTyVars"><span class="hs-identifier hs-var">pprTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121375"><span class="hs-identifier hs-var">ex_tvs</span></a></span><span>
</span><span id="line-902"></span><span>                                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[EqSpec] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[EqSpec]
</span><a href="#local-6989586621681121374"><span class="hs-identifier hs-var">eq_spec</span></a></span><span>
</span><span id="line-903"></span><span>                                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[TcType] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121373"><span class="hs-identifier hs-var">theta</span></a></span><span>
</span><span id="line-904"></span><span>                                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; SDoc
</span><a href="GHC.Core.TyCo.Ppr.html#pprTyVars"><span class="hs-identifier hs-var">pprTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121359"><span class="hs-identifier hs-var">ex_tvs'</span></a></span><span>
</span><span id="line-905"></span><span>                                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[TcType] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121368"><span class="hs-identifier hs-var">ctxt_res_tys</span></a></span><span>
</span><span id="line-906"></span><span>                                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Scaled TcType] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121357"><span class="hs-identifier hs-var">arg_tys'</span></a></span><span>
</span><span id="line-907"></span><span>                                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">HsConDetails
  (GenLocated SrcSpan (Pat GhcRn))
  (HsRecFields GhcRn (GenLocated SrcSpan (Pat GhcRn)))
-&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">HsConDetails
  (GenLocated SrcSpan (Pat GhcRn))
  (HsRecFields GhcRn (GenLocated SrcSpan (Pat GhcRn)))
HsConPatDetails GhcRn
</span><a href="#local-6989586621681121380"><span class="hs-identifier hs-var">arg_pats</span></a></span><span> </span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-908"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121375"><span class="hs-identifier hs-var">ex_tvs</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">[EqSpec] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[EqSpec]
</span><a href="#local-6989586621681121374"><span class="hs-identifier hs-var">eq_spec</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">[TcType] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121373"><span class="hs-identifier hs-var">theta</span></a></span><span>
</span><span id="line-909"></span><span>          </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-comment">-- The common case; no class bindings etc</span><span>
</span><span id="line-910"></span><span>                    </span><span class="hs-comment">-- (see Note [Arrows and patterns])</span><span>
</span><span id="line-911"></span><span>                    </span><span class="hs-special">(</span><span id="local-6989586621681121352"><span class="annot"><span class="annottext">HsConDetails
  (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc)))
</span><a href="#local-6989586621681121352"><span class="hs-identifier hs-var">arg_pats'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121351"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681121351"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ConLike
-&gt; [Scaled TcType]
-&gt; Checker (HsConPatDetails GhcRn) (HsConPatDetails GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tcConArgs"><span class="hs-identifier hs-var">tcConArgs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; ConLike
</span><a href="GHC.Core.ConLike.html#RealDataCon"><span class="hs-identifier hs-var">RealDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681121382"><span class="hs-identifier hs-var">data_con</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121354"><span class="hs-identifier hs-var">arg_tys_scaled</span></a></span><span>
</span><span id="line-912"></span><span>                                                  </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121385"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">HsConPatDetails GhcRn
</span><a href="#local-6989586621681121380"><span class="hs-identifier hs-var">arg_pats</span></a></span><span> </span><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681121379"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-913"></span><span>                  </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121349"><span class="annot"><span class="annottext">res_pat :: Pat GhcTc
</span><a href="#local-6989586621681121349"><span class="hs-identifier hs-var hs-var">res_pat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConPat :: forall p.
XConPat p -&gt; Located (ConLikeP p) -&gt; HsConPatDetails p -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#ConPat"><span class="hs-identifier hs-type">ConPat</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pat_con :: Located (ConLikeP GhcTc)
</span><a href="GHC.Hs.Pat.html#pat_con"><span class="hs-identifier hs-var">pat_con</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan ConLike
Located (ConLikeP GhcTc)
</span><a href="#local-6989586621681121370"><span class="hs-identifier hs-var">header</span></a></span><span>
</span><span id="line-914"></span><span>                                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pat_args :: HsConPatDetails GhcTc
</span><a href="GHC.Hs.Pat.html#pat_args"><span class="hs-identifier hs-var">pat_args</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsConDetails
  (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc)))
HsConPatDetails GhcTc
</span><a href="#local-6989586621681121352"><span class="hs-identifier hs-var">arg_pats'</span></a></span><span>
</span><span id="line-915"></span><span>                                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pat_con_ext :: XConPat GhcTc
</span><a href="GHC.Hs.Pat.html#pat_con_ext"><span class="hs-identifier hs-var">pat_con_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConPatTc :: [TcType]
-&gt; [TyVar] -&gt; [TyVar] -&gt; TcEvBinds -&gt; HsWrapper -&gt; ConPatTc
</span><a href="GHC.Hs.Pat.html#ConPatTc"><span class="hs-identifier hs-type">ConPatTc</span></a></span><span>
</span><span id="line-916"></span><span>                                           </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cpt_tvs :: [TyVar]
</span><a href="GHC.Hs.Pat.html#cpt_tvs"><span class="hs-identifier hs-var">cpt_tvs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_dicts :: [TyVar]
</span><a href="GHC.Hs.Pat.html#cpt_dicts"><span class="hs-identifier hs-var">cpt_dicts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-917"></span><span>                                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_binds :: TcEvBinds
</span><a href="GHC.Hs.Pat.html#cpt_binds"><span class="hs-identifier hs-var">cpt_binds</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcEvBinds
</span><a href="GHC.Tc.Types.Evidence.html#emptyTcEvBinds"><span class="hs-identifier hs-var">emptyTcEvBinds</span></a></span><span>
</span><span id="line-918"></span><span>                                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_arg_tys :: [TcType]
</span><a href="GHC.Hs.Pat.html#cpt_arg_tys"><span class="hs-identifier hs-var">cpt_arg_tys</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121368"><span class="hs-identifier hs-var">ctxt_res_tys</span></a></span><span>
</span><span id="line-919"></span><span>                                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_wrap :: HsWrapper
</span><a href="GHC.Hs.Pat.html#cpt_wrap"><span class="hs-identifier hs-var">cpt_wrap</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#idHsWrapper"><span class="hs-identifier hs-var">idHsWrapper</span></a></span><span>
</span><span id="line-920"></span><span>                                           </span><span class="hs-special">}</span><span>
</span><span id="line-921"></span><span>                                         </span><span class="hs-special">}</span><span>
</span><span id="line-922"></span><span>
</span><span id="line-923"></span><span>                  </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Pat GhcTc, a) -&gt; TcM (Pat GhcTc, a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper -&gt; Pat GhcTc -&gt; TcType -&gt; Pat GhcTc
</span><a href="GHC.Hs.Utils.html#mkHsWrapPat"><span class="hs-identifier hs-var">mkHsWrapPat</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121369"><span class="hs-identifier hs-var">wrap</span></a></span><span> </span><span class="annot"><span class="annottext">Pat GhcTc
</span><a href="#local-6989586621681121349"><span class="hs-identifier hs-var">res_pat</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121366"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681121351"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-924"></span><span>
</span><span id="line-925"></span><span>          </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>   </span><span class="hs-comment">-- The general case, with existential,</span><span>
</span><span id="line-926"></span><span>                    </span><span class="hs-comment">-- and local equality constraints</span><span>
</span><span id="line-927"></span><span>        </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121338"><span class="annot"><span class="annottext">theta' :: [TcType]
</span><a href="#local-6989586621681121338"><span class="hs-identifier hs-var hs-var">theta'</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; [TcType] -&gt; [TcType]
TCvSubst -&gt; [TcType] -&gt; [TcType]
</span><a href="GHC.Core.TyCo.Subst.html#substTheta"><span class="hs-identifier hs-var">substTheta</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681121360"><span class="hs-identifier hs-var">tenv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[EqSpec] -&gt; [TcType]
</span><a href="GHC.Core.DataCon.html#eqSpecPreds"><span class="hs-identifier hs-var">eqSpecPreds</span></a></span><span> </span><span class="annot"><span class="annottext">[EqSpec]
</span><a href="#local-6989586621681121374"><span class="hs-identifier hs-var">eq_spec</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType] -&gt; [TcType] -&gt; [TcType]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121373"><span class="hs-identifier hs-var">theta</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-928"></span><span>                           </span><span class="hs-comment">-- order is *important* as we generate the list of</span><span>
</span><span id="line-929"></span><span>                           </span><span class="hs-comment">-- dictionary binders from theta'</span><span>
</span><span id="line-930"></span><span>              </span><span id="local-6989586621681121336"><span class="annot"><span class="annottext">no_equalities :: Bool
</span><a href="#local-6989586621681121336"><span class="hs-identifier hs-var hs-var">no_equalities</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[EqSpec] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[EqSpec]
</span><a href="#local-6989586621681121374"><span class="hs-identifier hs-var">eq_spec</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(TcType -&gt; Bool) -&gt; [TcType] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="annot"><span class="annottext">TcType -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isEqPred"><span class="hs-identifier hs-var">isEqPred</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121373"><span class="hs-identifier hs-var">theta</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-931"></span><span>              </span><span id="local-6989586621681121333"><span class="annot"><span class="annottext">skol_info :: SkolemInfo
</span><a href="#local-6989586621681121333"><span class="hs-identifier hs-var hs-var">skol_info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConLike -&gt; HsMatchContext GhcRn -&gt; SkolemInfo
</span><a href="GHC.Tc.Types.Origin.html#PatSkol"><span class="hs-identifier hs-var">PatSkol</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; ConLike
</span><a href="GHC.Core.ConLike.html#RealDataCon"><span class="hs-identifier hs-var">RealDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681121382"><span class="hs-identifier hs-var">data_con</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681121331"><span class="hs-identifier hs-var">mc</span></a></span><span>
</span><span id="line-932"></span><span>              </span><span id="local-6989586621681121331"><span class="annot"><span class="annottext">mc :: HsMatchContext GhcRn
</span><a href="#local-6989586621681121331"><span class="hs-identifier hs-var hs-var">mc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">PatEnv -&gt; PatCtxt
</span><a href="GHC.Tc.Gen.Pat.html#pe_ctxt"><span class="hs-identifier hs-var hs-var">pe_ctxt</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121385"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-933"></span><span>                     </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LamPat"><span class="hs-identifier hs-type">LamPat</span></a></span><span> </span><span id="local-6989586621681121330"><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681121330"><span class="hs-identifier hs-var">mc</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681121330"><span class="hs-identifier hs-var">mc</span></a></span><span>
</span><span id="line-934"></span><span>                     </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetPat"><span class="hs-identifier hs-type">LetPat</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
forall p. HsMatchContext p
</span><a href="GHC.Hs.Expr.html#PatBindRhs"><span class="hs-identifier hs-var">PatBindRhs</span></a></span><span>
</span><span id="line-935"></span><span>
</span><span id="line-936"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121328"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681121328"><span class="hs-identifier hs-var">gadts_on</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Extension -&gt; IOEnv (Env TcGblEnv TcLclEnv) Bool
forall gbl lcl. Extension -&gt; TcRnIf gbl lcl Bool
</span><a href="GHC.Tc.Utils.Monad.html#xoptM"><span class="hs-identifier hs-var">xoptM</span></a></span><span> </span><span class="annot"><span class="annottext">Extension
</span><a href="../../ghc-boot-th/src/GHC.LanguageExtensions.Type.html#GADTs"><span class="hs-identifier hs-var">LangExt.GADTs</span></a></span><span>
</span><span id="line-937"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121326"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681121326"><span class="hs-identifier hs-var">families_on</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Extension -&gt; IOEnv (Env TcGblEnv TcLclEnv) Bool
forall gbl lcl. Extension -&gt; TcRnIf gbl lcl Bool
</span><a href="GHC.Tc.Utils.Monad.html#xoptM"><span class="hs-identifier hs-var">xoptM</span></a></span><span> </span><span class="annot"><span class="annottext">Extension
</span><a href="../../ghc-boot-th/src/GHC.LanguageExtensions.Type.html#TypeFamilies"><span class="hs-identifier hs-var">LangExt.TypeFamilies</span></a></span><span>
</span><span id="line-938"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#checkTc"><span class="hs-identifier hs-var">checkTc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681121336"><span class="hs-identifier hs-var">no_equalities</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681121328"><span class="hs-identifier hs-var">gadts_on</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681121326"><span class="hs-identifier hs-var">families_on</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-939"></span><span>                  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;A pattern match on a GADT requires the&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-940"></span><span>                   </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;GADTs or TypeFamilies language extension&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-941"></span><span>                  </span><span class="hs-comment">-- #2905 decided that a *pattern-match* of a GADT</span><span>
</span><span id="line-942"></span><span>                  </span><span class="hs-comment">-- should require the GADT language flag.</span><span>
</span><span id="line-943"></span><span>                  </span><span class="hs-comment">-- Re TypeFamilies see also #7156</span><span>
</span><span id="line-944"></span><span>
</span><span id="line-945"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121322"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121322"><span class="hs-identifier hs-var">given</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[TcType] -&gt; TcM [TyVar]
</span><a href="GHC.Tc.Utils.TcMType.html#newEvVars"><span class="hs-identifier hs-var">newEvVars</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121338"><span class="hs-identifier hs-var">theta'</span></a></span><span>
</span><span id="line-946"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121320"><span class="annot"><span class="annottext">TcEvBinds
</span><a href="#local-6989586621681121320"><span class="hs-identifier hs-var">ev_binds</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121319"><span class="annot"><span class="annottext">HsConDetails
  (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc)))
</span><a href="#local-6989586621681121319"><span class="hs-identifier hs-var">arg_pats'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121318"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681121318"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-947"></span><span>             </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SkolemInfo
-&gt; [TyVar]
-&gt; [TyVar]
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (HsConDetails
        (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
      a)
-&gt; TcM
     (TcEvBinds,
      (HsConDetails
         (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
       a))
forall result.
SkolemInfo
-&gt; [TyVar] -&gt; [TyVar] -&gt; TcM result -&gt; TcM (TcEvBinds, result)
</span><a href="GHC.Tc.Utils.Unify.html#checkConstraints"><span class="hs-identifier hs-var">checkConstraints</span></a></span><span> </span><span class="annot"><span class="annottext">SkolemInfo
</span><a href="#local-6989586621681121333"><span class="hs-identifier hs-var">skol_info</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121359"><span class="hs-identifier hs-var">ex_tvs'</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121322"><span class="hs-identifier hs-var">given</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv
   (Env TcGblEnv TcLclEnv)
   (HsConDetails
      (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
    a)
 -&gt; TcM
      (TcEvBinds,
       (HsConDetails
          (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
        a)))
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (HsConDetails
        (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
      a)
-&gt; TcM
     (TcEvBinds,
      (HsConDetails
         (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
       a))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-948"></span><span>                </span><span class="annot"><span class="annottext">ConLike
-&gt; [Scaled TcType]
-&gt; Checker (HsConPatDetails GhcRn) (HsConPatDetails GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tcConArgs"><span class="hs-identifier hs-var">tcConArgs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; ConLike
</span><a href="GHC.Core.ConLike.html#RealDataCon"><span class="hs-identifier hs-var">RealDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681121382"><span class="hs-identifier hs-var">data_con</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121354"><span class="hs-identifier hs-var">arg_tys_scaled</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121385"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">HsConPatDetails GhcRn
</span><a href="#local-6989586621681121380"><span class="hs-identifier hs-var">arg_pats</span></a></span><span> </span><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681121379"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-949"></span><span>
</span><span id="line-950"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121316"><span class="annot"><span class="annottext">res_pat :: Pat GhcTc
</span><a href="#local-6989586621681121316"><span class="hs-identifier hs-var hs-var">res_pat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConPat :: forall p.
XConPat p -&gt; Located (ConLikeP p) -&gt; HsConPatDetails p -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#ConPat"><span class="hs-identifier hs-type">ConPat</span></a></span><span>
</span><span id="line-951"></span><span>                </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pat_con :: Located (ConLikeP GhcTc)
</span><a href="GHC.Hs.Pat.html#pat_con"><span class="hs-identifier hs-var">pat_con</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan ConLike
Located (ConLikeP GhcTc)
</span><a href="#local-6989586621681121370"><span class="hs-identifier hs-var">header</span></a></span><span>
</span><span id="line-952"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pat_args :: HsConPatDetails GhcTc
</span><a href="GHC.Hs.Pat.html#pat_args"><span class="hs-identifier hs-var">pat_args</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsConDetails
  (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc)))
HsConPatDetails GhcTc
</span><a href="#local-6989586621681121319"><span class="hs-identifier hs-var">arg_pats'</span></a></span><span>
</span><span id="line-953"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pat_con_ext :: XConPat GhcTc
</span><a href="GHC.Hs.Pat.html#pat_con_ext"><span class="hs-identifier hs-var">pat_con_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConPatTc :: [TcType]
-&gt; [TyVar] -&gt; [TyVar] -&gt; TcEvBinds -&gt; HsWrapper -&gt; ConPatTc
</span><a href="GHC.Hs.Pat.html#ConPatTc"><span class="hs-identifier hs-type">ConPatTc</span></a></span><span>
</span><span id="line-954"></span><span>                  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cpt_tvs :: [TyVar]
</span><a href="GHC.Hs.Pat.html#cpt_tvs"><span class="hs-identifier hs-var">cpt_tvs</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121359"><span class="hs-identifier hs-var">ex_tvs'</span></a></span><span>
</span><span id="line-955"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_dicts :: [TyVar]
</span><a href="GHC.Hs.Pat.html#cpt_dicts"><span class="hs-identifier hs-var">cpt_dicts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121322"><span class="hs-identifier hs-var">given</span></a></span><span>
</span><span id="line-956"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_binds :: TcEvBinds
</span><a href="GHC.Hs.Pat.html#cpt_binds"><span class="hs-identifier hs-var">cpt_binds</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcEvBinds
</span><a href="#local-6989586621681121320"><span class="hs-identifier hs-var">ev_binds</span></a></span><span>
</span><span id="line-957"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_arg_tys :: [TcType]
</span><a href="GHC.Hs.Pat.html#cpt_arg_tys"><span class="hs-identifier hs-var">cpt_arg_tys</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121368"><span class="hs-identifier hs-var">ctxt_res_tys</span></a></span><span>
</span><span id="line-958"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_wrap :: HsWrapper
</span><a href="GHC.Hs.Pat.html#cpt_wrap"><span class="hs-identifier hs-var">cpt_wrap</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#idHsWrapper"><span class="hs-identifier hs-var">idHsWrapper</span></a></span><span>
</span><span id="line-959"></span><span>                  </span><span class="hs-special">}</span><span>
</span><span id="line-960"></span><span>                </span><span class="hs-special">}</span><span>
</span><span id="line-961"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Pat GhcTc, a) -&gt; TcM (Pat GhcTc, a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper -&gt; Pat GhcTc -&gt; TcType -&gt; Pat GhcTc
</span><a href="GHC.Hs.Utils.html#mkHsWrapPat"><span class="hs-identifier hs-var">mkHsWrapPat</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121369"><span class="hs-identifier hs-var">wrap</span></a></span><span> </span><span class="annot"><span class="annottext">Pat GhcTc
</span><a href="#local-6989586621681121316"><span class="hs-identifier hs-var">res_pat</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121366"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681121318"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-962"></span><span>        </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-963"></span><span>
</span><span id="line-964"></span><span id="local-6989586621681122177"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcPatSynPat"><span class="hs-identifier hs-type">tcPatSynPat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PatEnv"><span class="hs-identifier hs-type">PatEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.PatSyn.html#PatSyn"><span class="hs-identifier hs-type">PatSyn</span></a></span><span>
</span><span id="line-965"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpSigmaType"><span class="hs-identifier hs-type">ExpSigmaType</span></a></span><span>         </span><span class="hs-comment">-- Type of the pattern</span><span>
</span><span id="line-966"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#HsConPatDetails"><span class="hs-identifier hs-type">HsConPatDetails</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681122177"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-967"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#Pat"><span class="hs-identifier hs-type">Pat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681122177"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-968"></span><span id="tcPatSynPat"><span class="annot"><span class="annottext">tcPatSynPat :: forall a.
PatEnv
-&gt; Located Name
-&gt; PatSyn
-&gt; Scaled ExpSigmaType
-&gt; HsConPatDetails GhcRn
-&gt; TcM a
-&gt; TcM (Pat GhcTc, a)
</span><a href="GHC.Tc.Gen.Pat.html#tcPatSynPat"><span class="hs-identifier hs-var hs-var">tcPatSynPat</span></a></span></span><span> </span><span id="local-6989586621681121281"><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121281"><span class="hs-identifier hs-var">penv</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681121280"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121280"><span class="hs-identifier hs-var">con_span</span></a></span></span><span> </span><span class="annot"><span class="annottext">Name
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681121279"><span class="annot"><span class="annottext">PatSyn
</span><a href="#local-6989586621681121279"><span class="hs-identifier hs-var">pat_syn</span></a></span></span><span> </span><span id="local-6989586621681121278"><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121278"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span id="local-6989586621681121277"><span class="annot"><span class="annottext">HsConPatDetails GhcRn
</span><a href="#local-6989586621681121277"><span class="hs-identifier hs-var">arg_pats</span></a></span></span><span> </span><span id="local-6989586621681121276"><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681121276"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-969"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121275"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121275"><span class="hs-identifier hs-var">univ_tvs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121274"><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121274"><span class="hs-identifier hs-var">req_theta</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121273"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121273"><span class="hs-identifier hs-var">ex_tvs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121272"><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121272"><span class="hs-identifier hs-var">prov_theta</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121271"><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121271"><span class="hs-identifier hs-var">arg_tys</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121270"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121270"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PatSyn
-&gt; ([TyVar], [TcType], [TyVar], [TcType], [Scaled TcType], TcType)
</span><a href="GHC.Core.PatSyn.html#patSynSig"><span class="hs-identifier hs-var">patSynSig</span></a></span><span> </span><span class="annot"><span class="annottext">PatSyn
</span><a href="#local-6989586621681121279"><span class="hs-identifier hs-var">pat_syn</span></a></span><span>
</span><span id="line-970"></span><span>
</span><span id="line-971"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121268"><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681121268"><span class="hs-identifier hs-var">subst</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121267"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121267"><span class="hs-identifier hs-var">univ_tvs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; TcM (TCvSubst, [TyVar])
</span><a href="GHC.Tc.Utils.TcMType.html#newMetaTyVars"><span class="hs-identifier hs-var">newMetaTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121275"><span class="hs-identifier hs-var">univ_tvs</span></a></span><span>
</span><span id="line-972"></span><span>
</span><span id="line-973"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121265"><span class="annot"><span class="annottext">all_arg_tys :: [TcType]
</span><a href="#local-6989586621681121265"><span class="hs-identifier hs-var hs-var">all_arg_tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121270"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">TcType -&gt; [TcType] -&gt; [TcType]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121272"><span class="hs-identifier hs-var">prov_theta</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType] -&gt; [TcType] -&gt; [TcType]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Scaled TcType -&gt; TcType) -&gt; [Scaled TcType] -&gt; [TcType]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled TcType -&gt; TcType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121271"><span class="hs-identifier hs-var">arg_tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-974"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; [TcType] -&gt; PatEnv -&gt; TcRn ()
</span><a href="GHC.Tc.Gen.Pat.html#checkExistentials"><span class="hs-identifier hs-var">checkExistentials</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121273"><span class="hs-identifier hs-var">ex_tvs</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121265"><span class="hs-identifier hs-var">all_arg_tys</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121281"><span class="hs-identifier hs-var">penv</span></a></span><span>
</span><span id="line-975"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121264"><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681121264"><span class="hs-identifier hs-var">tenv</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121263"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121263"><span class="hs-identifier hs-var">ex_tvs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TCvSubst -&gt; [TyVar] -&gt; TcM (TCvSubst, [TyVar])
</span><a href="GHC.Tc.Utils.Instantiate.html#tcInstSuperSkolTyVarsX"><span class="hs-identifier hs-var">tcInstSuperSkolTyVarsX</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681121268"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121273"><span class="hs-identifier hs-var">ex_tvs</span></a></span><span>
</span><span id="line-976"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121262"><span class="annot"><span class="annottext">ty' :: TcType
</span><a href="#local-6989586621681121262"><span class="hs-identifier hs-var hs-var">ty'</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; TcType -&gt; TcType
TCvSubst -&gt; TcType -&gt; TcType
</span><a href="GHC.Core.TyCo.Subst.html#substTy"><span class="hs-identifier hs-var">substTy</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681121264"><span class="hs-identifier hs-var">tenv</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121270"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-977"></span><span>              </span><span id="local-6989586621681121260"><span class="annot"><span class="annottext">arg_tys' :: [Scaled TcType]
</span><a href="#local-6989586621681121260"><span class="hs-identifier hs-var hs-var">arg_tys'</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; [Scaled TcType] -&gt; [Scaled TcType]
TCvSubst -&gt; [Scaled TcType] -&gt; [Scaled TcType]
</span><a href="GHC.Core.TyCo.Subst.html#substScaledTys"><span class="hs-identifier hs-var">substScaledTys</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681121264"><span class="hs-identifier hs-var">tenv</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121271"><span class="hs-identifier hs-var">arg_tys</span></a></span><span>
</span><span id="line-978"></span><span>              </span><span id="local-6989586621681121259"><span class="annot"><span class="annottext">pat_mult :: TcType
</span><a href="#local-6989586621681121259"><span class="hs-identifier hs-var hs-var">pat_mult</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; TcType
forall a. Scaled a -&gt; TcType
</span><a href="GHC.Core.TyCo.Rep.html#scaledMult"><span class="hs-identifier hs-var">scaledMult</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121278"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-979"></span><span>              </span><span id="local-6989586621681121258"><span class="annot"><span class="annottext">arg_tys_scaled :: [Scaled TcType]
</span><a href="#local-6989586621681121258"><span class="hs-identifier hs-var hs-var">arg_tys_scaled</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Scaled TcType -&gt; Scaled TcType)
-&gt; [Scaled TcType] -&gt; [Scaled TcType]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; Scaled TcType -&gt; Scaled TcType
forall a. TcType -&gt; Scaled a -&gt; Scaled a
</span><a href="GHC.Core.Multiplicity.html#scaleScaled"><span class="hs-identifier hs-var">scaleScaled</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121259"><span class="hs-identifier hs-var">pat_mult</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121260"><span class="hs-identifier hs-var">arg_tys'</span></a></span><span>
</span><span id="line-980"></span><span>              </span><span id="local-6989586621681121257"><span class="annot"><span class="annottext">prov_theta' :: [TcType]
</span><a href="#local-6989586621681121257"><span class="hs-identifier hs-var hs-var">prov_theta'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; [TcType] -&gt; [TcType]
TCvSubst -&gt; [TcType] -&gt; [TcType]
</span><a href="GHC.Core.TyCo.Subst.html#substTheta"><span class="hs-identifier hs-var">substTheta</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681121264"><span class="hs-identifier hs-var">tenv</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121272"><span class="hs-identifier hs-var">prov_theta</span></a></span><span>
</span><span id="line-981"></span><span>              </span><span id="local-6989586621681121256"><span class="annot"><span class="annottext">req_theta' :: [TcType]
</span><a href="#local-6989586621681121256"><span class="hs-identifier hs-var hs-var">req_theta'</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; [TcType] -&gt; [TcType]
TCvSubst -&gt; [TcType] -&gt; [TcType]
</span><a href="GHC.Core.TyCo.Subst.html#substTheta"><span class="hs-identifier hs-var">substTheta</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681121264"><span class="hs-identifier hs-var">tenv</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121274"><span class="hs-identifier hs-var">req_theta</span></a></span><span>
</span><span id="line-982"></span><span>
</span><span id="line-983"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121255"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121255"><span class="hs-identifier hs-var">mult_wrap</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; TcM HsWrapper
forall a. Scaled a -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Gen.Pat.html#checkManyPattern"><span class="hs-identifier hs-var">checkManyPattern</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121278"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-984"></span><span>            </span><span class="hs-comment">-- See Note [Wrapper returned from tcSubMult] in GHC.Tc.Utils.Unify.</span><span>
</span><span id="line-985"></span><span>
</span><span id="line-986"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121254"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121254"><span class="hs-identifier hs-var">wrap</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">PatEnv -&gt; ExpSigmaType -&gt; TcType -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Gen.Pat.html#tc_sub_type"><span class="hs-identifier hs-var">tc_sub_type</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121281"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121278"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121262"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-987"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcPatSynPat&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PatSyn -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">PatSyn
</span><a href="#local-6989586621681121279"><span class="hs-identifier hs-var">pat_syn</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-988"></span><span>                                 </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121278"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-989"></span><span>                                 </span><span class="annot"><span class="annottext">TcType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121262"><span class="hs-identifier hs-var">ty'</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-990"></span><span>                                 </span><span class="annot"><span class="annottext">[TyVar] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121263"><span class="hs-identifier hs-var">ex_tvs'</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-991"></span><span>                                 </span><span class="annot"><span class="annottext">[TcType] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121257"><span class="hs-identifier hs-var">prov_theta'</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-992"></span><span>                                 </span><span class="annot"><span class="annottext">[TcType] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121256"><span class="hs-identifier hs-var">req_theta'</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-993"></span><span>                                 </span><span class="annot"><span class="annottext">[Scaled TcType] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121260"><span class="hs-identifier hs-var">arg_tys'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-994"></span><span>
</span><span id="line-995"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121253"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121253"><span class="hs-identifier hs-var">prov_dicts'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[TcType] -&gt; TcM [TyVar]
</span><a href="GHC.Tc.Utils.TcMType.html#newEvVars"><span class="hs-identifier hs-var">newEvVars</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121257"><span class="hs-identifier hs-var">prov_theta'</span></a></span><span>
</span><span id="line-996"></span><span>
</span><span id="line-997"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121252"><span class="annot"><span class="annottext">skol_info :: SkolemInfo
</span><a href="#local-6989586621681121252"><span class="hs-identifier hs-var hs-var">skol_info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">PatEnv -&gt; PatCtxt
</span><a href="GHC.Tc.Gen.Pat.html#pe_ctxt"><span class="hs-identifier hs-var hs-var">pe_ctxt</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121281"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-998"></span><span>                            </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LamPat"><span class="hs-identifier hs-type">LamPat</span></a></span><span> </span><span id="local-6989586621681121251"><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681121251"><span class="hs-identifier hs-var">mc</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ConLike -&gt; HsMatchContext GhcRn -&gt; SkolemInfo
</span><a href="GHC.Tc.Types.Origin.html#PatSkol"><span class="hs-identifier hs-var">PatSkol</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PatSyn -&gt; ConLike
</span><a href="GHC.Core.ConLike.html#PatSynCon"><span class="hs-identifier hs-var">PatSynCon</span></a></span><span> </span><span class="annot"><span class="annottext">PatSyn
</span><a href="#local-6989586621681121279"><span class="hs-identifier hs-var">pat_syn</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681121251"><span class="hs-identifier hs-var">mc</span></a></span><span>
</span><span id="line-999"></span><span>                            </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetPat"><span class="hs-identifier hs-type">LetPat</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SkolemInfo
</span><a href="GHC.Tc.Types.Origin.html#UnkSkol"><span class="hs-identifier hs-var">UnkSkol</span></a></span><span> </span><span class="hs-comment">-- Doesn't matter</span><span>
</span><span id="line-1000"></span><span>
</span><span id="line-1001"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121249"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121249"><span class="hs-identifier hs-var">req_wrap</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CtOrigin -&gt; [TcType] -&gt; [TcType] -&gt; TcM HsWrapper
</span><a href="GHC.Tc.Utils.Instantiate.html#instCall"><span class="hs-identifier hs-var">instCall</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="GHC.Tc.Types.Origin.html#PatOrigin"><span class="hs-identifier hs-var">PatOrigin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyVar] -&gt; [TcType]
</span><a href="GHC.Core.TyCo.Rep.html#mkTyVarTys"><span class="hs-identifier hs-var">mkTyVarTys</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121267"><span class="hs-identifier hs-var">univ_tvs'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121256"><span class="hs-identifier hs-var">req_theta'</span></a></span><span>
</span><span id="line-1002"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;instCall&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121249"><span class="hs-identifier hs-var">req_wrap</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1003"></span><span>
</span><span id="line-1004"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;checkConstraints {&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">Outputable.empty</span></a></span><span>
</span><span id="line-1005"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121245"><span class="annot"><span class="annottext">TcEvBinds
</span><a href="#local-6989586621681121245"><span class="hs-identifier hs-var">ev_binds</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121244"><span class="annot"><span class="annottext">HsConDetails
  (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc)))
</span><a href="#local-6989586621681121244"><span class="hs-identifier hs-var">arg_pats'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121243"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681121243"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1006"></span><span>             </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SkolemInfo
-&gt; [TyVar]
-&gt; [TyVar]
-&gt; TcM
     (HsConDetails
        (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
      a)
-&gt; TcM
     (TcEvBinds,
      (HsConDetails
         (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
       a))
forall result.
SkolemInfo
-&gt; [TyVar] -&gt; [TyVar] -&gt; TcM result -&gt; TcM (TcEvBinds, result)
</span><a href="GHC.Tc.Utils.Unify.html#checkConstraints"><span class="hs-identifier hs-var">checkConstraints</span></a></span><span> </span><span class="annot"><span class="annottext">SkolemInfo
</span><a href="#local-6989586621681121252"><span class="hs-identifier hs-var">skol_info</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121263"><span class="hs-identifier hs-var">ex_tvs'</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121253"><span class="hs-identifier hs-var">prov_dicts'</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM
   (HsConDetails
      (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
    a)
 -&gt; TcM
      (TcEvBinds,
       (HsConDetails
          (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
        a)))
-&gt; TcM
     (HsConDetails
        (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
      a)
-&gt; TcM
     (TcEvBinds,
      (HsConDetails
         (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
       a))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1007"></span><span>                </span><span class="annot"><span class="annottext">ConLike
-&gt; [Scaled TcType]
-&gt; Checker (HsConPatDetails GhcRn) (HsConPatDetails GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tcConArgs"><span class="hs-identifier hs-var">tcConArgs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PatSyn -&gt; ConLike
</span><a href="GHC.Core.ConLike.html#PatSynCon"><span class="hs-identifier hs-var">PatSynCon</span></a></span><span> </span><span class="annot"><span class="annottext">PatSyn
</span><a href="#local-6989586621681121279"><span class="hs-identifier hs-var">pat_syn</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121258"><span class="hs-identifier hs-var">arg_tys_scaled</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121281"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">HsConPatDetails GhcRn
</span><a href="#local-6989586621681121277"><span class="hs-identifier hs-var">arg_pats</span></a></span><span> </span><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681121276"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-1008"></span><span>
</span><span id="line-1009"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;checkConstraints }&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcEvBinds -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcEvBinds
</span><a href="#local-6989586621681121245"><span class="hs-identifier hs-var">ev_binds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1010"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121242"><span class="annot"><span class="annottext">res_pat :: Pat GhcTc
</span><a href="#local-6989586621681121242"><span class="hs-identifier hs-var hs-var">res_pat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConPat :: forall p.
XConPat p -&gt; Located (ConLikeP p) -&gt; HsConPatDetails p -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#ConPat"><span class="hs-identifier hs-type">ConPat</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pat_con :: Located (ConLikeP GhcTc)
</span><a href="GHC.Hs.Pat.html#pat_con"><span class="hs-identifier hs-var">pat_con</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; ConLike -&gt; GenLocated SrcSpan ConLike
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121280"><span class="hs-identifier hs-var">con_span</span></a></span><span> </span><span class="annot"><span class="annottext">(ConLike -&gt; GenLocated SrcSpan ConLike)
-&gt; ConLike -&gt; GenLocated SrcSpan ConLike
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">PatSyn -&gt; ConLike
</span><a href="GHC.Core.ConLike.html#PatSynCon"><span class="hs-identifier hs-var">PatSynCon</span></a></span><span> </span><span class="annot"><span class="annottext">PatSyn
</span><a href="#local-6989586621681121279"><span class="hs-identifier hs-var">pat_syn</span></a></span><span>
</span><span id="line-1011"></span><span>                               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pat_args :: HsConPatDetails GhcTc
</span><a href="GHC.Hs.Pat.html#pat_args"><span class="hs-identifier hs-var">pat_args</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsConDetails
  (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc)))
HsConPatDetails GhcTc
</span><a href="#local-6989586621681121244"><span class="hs-identifier hs-var">arg_pats'</span></a></span><span>
</span><span id="line-1012"></span><span>                               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pat_con_ext :: XConPat GhcTc
</span><a href="GHC.Hs.Pat.html#pat_con_ext"><span class="hs-identifier hs-var">pat_con_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConPatTc :: [TcType]
-&gt; [TyVar] -&gt; [TyVar] -&gt; TcEvBinds -&gt; HsWrapper -&gt; ConPatTc
</span><a href="GHC.Hs.Pat.html#ConPatTc"><span class="hs-identifier hs-type">ConPatTc</span></a></span><span>
</span><span id="line-1013"></span><span>                                 </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cpt_tvs :: [TyVar]
</span><a href="GHC.Hs.Pat.html#cpt_tvs"><span class="hs-identifier hs-var">cpt_tvs</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121263"><span class="hs-identifier hs-var">ex_tvs'</span></a></span><span>
</span><span id="line-1014"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_dicts :: [TyVar]
</span><a href="GHC.Hs.Pat.html#cpt_dicts"><span class="hs-identifier hs-var">cpt_dicts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121253"><span class="hs-identifier hs-var">prov_dicts'</span></a></span><span>
</span><span id="line-1015"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_binds :: TcEvBinds
</span><a href="GHC.Hs.Pat.html#cpt_binds"><span class="hs-identifier hs-var">cpt_binds</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcEvBinds
</span><a href="#local-6989586621681121245"><span class="hs-identifier hs-var">ev_binds</span></a></span><span>
</span><span id="line-1016"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_arg_tys :: [TcType]
</span><a href="GHC.Hs.Pat.html#cpt_arg_tys"><span class="hs-identifier hs-var">cpt_arg_tys</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; [TcType]
</span><a href="GHC.Core.TyCo.Rep.html#mkTyVarTys"><span class="hs-identifier hs-var">mkTyVarTys</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121267"><span class="hs-identifier hs-var">univ_tvs'</span></a></span><span>
</span><span id="line-1017"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_wrap :: HsWrapper
</span><a href="GHC.Hs.Pat.html#cpt_wrap"><span class="hs-identifier hs-var">cpt_wrap</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121249"><span class="hs-identifier hs-var">req_wrap</span></a></span><span>
</span><span id="line-1018"></span><span>                                 </span><span class="hs-special">}</span><span>
</span><span id="line-1019"></span><span>                               </span><span class="hs-special">}</span><span>
</span><span id="line-1020"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121241"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121241"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#readExpType"><span class="hs-identifier hs-var">readExpType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121278"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1021"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Pat GhcTc, a) -&gt; TcM (Pat GhcTc, a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper -&gt; Pat GhcTc -&gt; TcType -&gt; Pat GhcTc
</span><a href="GHC.Hs.Utils.html#mkHsWrapPat"><span class="hs-identifier hs-var">mkHsWrapPat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121254"><span class="hs-identifier hs-var">wrap</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper -&gt; HsWrapper -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121255"><span class="hs-identifier hs-var">mult_wrap</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Pat GhcTc
</span><a href="#local-6989586621681121242"><span class="hs-identifier hs-var">res_pat</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121241"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681121243"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1022"></span><span>
</span><span id="line-1023"></span><span class="hs-comment">----------------------------</span><span>
</span><span id="line-1024"></span><span class="hs-comment">-- | Convenient wrapper for calling a matchExpectedXXX function</span><span>
</span><span id="line-1025"></span><span id="local-6989586621681122245"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#matchExpectedPatTy"><span class="hs-identifier hs-type">matchExpectedPatTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcRhoType"><span class="hs-identifier hs-type">TcRhoType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#TcCoercionN"><span class="hs-identifier hs-type">TcCoercionN</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681122245"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1026"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PatEnv"><span class="hs-identifier hs-type">PatEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpSigmaType"><span class="hs-identifier hs-type">ExpSigmaType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#HsWrapper"><span class="hs-identifier hs-type">HsWrapper</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681122245"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1027"></span><span class="hs-comment">-- See Note [Matching polytyped patterns]</span><span>
</span><span id="line-1028"></span><span class="hs-comment">-- Returns a wrapper : pat_ty ~R inner_ty</span><span>
</span><span id="line-1029"></span><span id="matchExpectedPatTy"><span class="annot"><span class="annottext">matchExpectedPatTy :: forall a.
(TcType -&gt; TcM (TcCoercionN, a))
-&gt; PatEnv -&gt; ExpSigmaType -&gt; TcM (HsWrapper, a)
</span><a href="GHC.Tc.Gen.Pat.html#matchExpectedPatTy"><span class="hs-identifier hs-var hs-var">matchExpectedPatTy</span></a></span></span><span> </span><span id="local-6989586621681121232"><span class="annot"><span class="annottext">TcType -&gt; TcM (TcCoercionN, a)
</span><a href="#local-6989586621681121232"><span class="hs-identifier hs-var">inner_match</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PE"><span class="hs-identifier hs-type">PE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pe_orig :: PatEnv -&gt; CtOrigin
</span><a href="GHC.Tc.Gen.Pat.html#pe_orig"><span class="hs-identifier hs-var">pe_orig</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681121231"><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621681121231"><span class="hs-identifier hs-var">orig</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span id="local-6989586621681121230"><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681121230"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span>
</span><span id="line-1030"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121229"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121229"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#expTypeToType"><span class="hs-identifier hs-var">expTypeToType</span></a></span><span> </span><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681121230"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-1031"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121228"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121228"><span class="hs-identifier hs-var">wrap</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121227"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121227"><span class="hs-identifier hs-var">pat_rho</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CtOrigin -&gt; TcType -&gt; TcM (HsWrapper, TcType)
</span><a href="GHC.Tc.Utils.Instantiate.html#topInstantiate"><span class="hs-identifier hs-var">topInstantiate</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621681121231"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121229"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-1032"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121225"><span class="annot"><span class="annottext">TcCoercionN
</span><a href="#local-6989586621681121225"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121224"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681121224"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcType -&gt; TcM (TcCoercionN, a)
</span><a href="#local-6989586621681121232"><span class="hs-identifier hs-var">inner_match</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121227"><span class="hs-identifier hs-var">pat_rho</span></a></span><span>
</span><span id="line-1033"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;matchExpectedPatTy&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121229"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121228"><span class="hs-identifier hs-var">wrap</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1034"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(HsWrapper, a) -&gt; TcM (HsWrapper, a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcCoercionN -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#mkWpCastN"><span class="hs-identifier hs-var">mkWpCastN</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcCoercionN -&gt; TcCoercionN
</span><a href="GHC.Tc.Types.Evidence.html#mkTcSymCo"><span class="hs-identifier hs-var">mkTcSymCo</span></a></span><span> </span><span class="annot"><span class="annottext">TcCoercionN
</span><a href="#local-6989586621681121225"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">HsWrapper -&gt; HsWrapper -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121228"><span class="hs-identifier hs-var">wrap</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681121224"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1035"></span><span>
</span><span id="line-1036"></span><span class="hs-comment">----------------------------</span><span>
</span><span id="line-1037"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#matchExpectedConTy"><span class="hs-identifier hs-type">matchExpectedConTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PatEnv"><span class="hs-identifier hs-type">PatEnv</span></a></span><span>
</span><span id="line-1038"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span>      </span><span class="hs-comment">-- The TyCon that this data</span><span>
</span><span id="line-1039"></span><span>                                 </span><span class="hs-comment">-- constructor actually returns</span><span>
</span><span id="line-1040"></span><span>                                 </span><span class="hs-comment">-- In the case of a data family this is</span><span>
</span><span id="line-1041"></span><span>                                 </span><span class="hs-comment">-- the /representation/ TyCon</span><span>
</span><span id="line-1042"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpSigmaType"><span class="hs-identifier hs-type">ExpSigmaType</span></a></span><span>  </span><span class="hs-comment">-- The type of the pattern; in the</span><span>
</span><span id="line-1043"></span><span>                                           </span><span class="hs-comment">-- case of a data family this would</span><span>
</span><span id="line-1044"></span><span>                                           </span><span class="hs-comment">-- mention the /family/ TyCon</span><span>
</span><span id="line-1045"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#HsWrapper"><span class="hs-identifier hs-type">HsWrapper</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcSigmaType"><span class="hs-identifier hs-type">TcSigmaType</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1046"></span><span class="hs-comment">-- See Note [Matching constructor patterns]</span><span>
</span><span id="line-1047"></span><span class="hs-comment">-- Returns a wrapper : pat_ty &quot;-&gt;&quot; T ty1 ... tyn</span><span>
</span><span id="line-1048"></span><span id="matchExpectedConTy"><span class="annot"><span class="annottext">matchExpectedConTy :: PatEnv -&gt; TyCon -&gt; Scaled ExpSigmaType -&gt; TcM (HsWrapper, [TcType])
</span><a href="GHC.Tc.Gen.Pat.html#matchExpectedConTy"><span class="hs-identifier hs-var hs-var">matchExpectedConTy</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PE"><span class="hs-identifier hs-type">PE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pe_orig :: PatEnv -&gt; CtOrigin
</span><a href="GHC.Tc.Gen.Pat.html#pe_orig"><span class="hs-identifier hs-var">pe_orig</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681121222"><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621681121222"><span class="hs-identifier hs-var">orig</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span id="local-6989586621681121221"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681121221"><span class="hs-identifier hs-var">data_tc</span></a></span></span><span> </span><span id="local-6989586621681121220"><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121220"><span class="hs-identifier hs-var">exp_pat_ty</span></a></span></span><span>
</span><span id="line-1049"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121219"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681121219"><span class="hs-identifier hs-var">fam_tc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121218"><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121218"><span class="hs-identifier hs-var">fam_args</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121217"><span class="annot"><span class="annottext">CoAxiom Unbranched
</span><a href="#local-6989586621681121217"><span class="hs-identifier hs-var">co_tc</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Maybe (TyCon, [TcType], CoAxiom Unbranched)
</span><a href="GHC.Core.TyCon.html#tyConFamInstSig_maybe"><span class="hs-identifier hs-var">tyConFamInstSig_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681121221"><span class="hs-identifier hs-var">data_tc</span></a></span><span>
</span><span id="line-1050"></span><span>         </span><span class="hs-comment">-- Comments refer to Note [Matching constructor patterns]</span><span>
</span><span id="line-1051"></span><span>         </span><span class="hs-comment">-- co_tc :: forall a. T [a] ~ T7 a</span><span>
</span><span id="line-1052"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121215"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121215"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#expTypeToType"><span class="hs-identifier hs-var">expTypeToType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121220"><span class="hs-identifier hs-var">exp_pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1053"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121214"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121214"><span class="hs-identifier hs-var">wrap</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121213"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121213"><span class="hs-identifier hs-var">pat_rho</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CtOrigin -&gt; TcType -&gt; TcM (HsWrapper, TcType)
</span><a href="GHC.Tc.Utils.Instantiate.html#topInstantiate"><span class="hs-identifier hs-var">topInstantiate</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621681121222"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121215"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-1054"></span><span>
</span><span id="line-1055"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121212"><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681121212"><span class="hs-identifier hs-var">subst</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121211"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121211"><span class="hs-identifier hs-var">tvs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; TcM (TCvSubst, [TyVar])
</span><a href="GHC.Tc.Utils.TcMType.html#newMetaTyVars"><span class="hs-identifier hs-var">newMetaTyVars</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [TyVar]
</span><a href="GHC.Core.TyCon.html#tyConTyVars"><span class="hs-identifier hs-var hs-var">tyConTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681121221"><span class="hs-identifier hs-var">data_tc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1056"></span><span>             </span><span class="hs-comment">-- tys = [ty1,ty2]</span><span>
</span><span id="line-1057"></span><span>
</span><span id="line-1058"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;matchExpectedConTy&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">TyCon -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681121221"><span class="hs-identifier hs-var">data_tc</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1059"></span><span>                                             </span><span class="annot"><span class="annottext">[TyVar] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [TyVar]
</span><a href="GHC.Core.TyCon.html#tyConTyVars"><span class="hs-identifier hs-var hs-var">tyConTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681121221"><span class="hs-identifier hs-var">data_tc</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-1060"></span><span>                                             </span><span class="annot"><span class="annottext">TyCon -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681121219"><span class="hs-identifier hs-var">fam_tc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[TcType] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121218"><span class="hs-identifier hs-var">fam_args</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1061"></span><span>                                             </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121220"><span class="hs-identifier hs-var">exp_pat_ty</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1062"></span><span>                                             </span><span class="annot"><span class="annottext">TcType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121215"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1063"></span><span>                                             </span><span class="annot"><span class="annottext">TcType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121213"><span class="hs-identifier hs-var">pat_rho</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">HsWrapper -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121214"><span class="hs-identifier hs-var">wrap</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1064"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121209"><span class="annot"><span class="annottext">TcCoercionN
</span><a href="#local-6989586621681121209"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe (HsExpr GhcRn) -&gt; TcType -&gt; TcType -&gt; TcM TcCoercionN
</span><a href="GHC.Tc.Utils.Unify.html#unifyType"><span class="hs-identifier hs-var">unifyType</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (HsExpr GhcRn)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [TcType] -&gt; TcType
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681121219"><span class="hs-identifier hs-var">fam_tc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; [TcType] -&gt; [TcType]
TCvSubst -&gt; [TcType] -&gt; [TcType]
</span><a href="GHC.Core.TyCo.Subst.html#substTys"><span class="hs-identifier hs-var">substTys</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681121212"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121218"><span class="hs-identifier hs-var">fam_args</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121213"><span class="hs-identifier hs-var">pat_rho</span></a></span><span>
</span><span id="line-1065"></span><span>             </span><span class="hs-comment">-- co1 : T (ty1,ty2) ~N pat_rho</span><span>
</span><span id="line-1066"></span><span>             </span><span class="hs-comment">-- could use tcSubType here... but it's the wrong way round</span><span>
</span><span id="line-1067"></span><span>             </span><span class="hs-comment">-- for actual vs. expected in error messages.</span><span>
</span><span id="line-1068"></span><span>
</span><span id="line-1069"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121206"><span class="annot"><span class="annottext">tys' :: [TcType]
</span><a href="#local-6989586621681121206"><span class="hs-identifier hs-var hs-var">tys'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; [TcType]
</span><a href="GHC.Core.TyCo.Rep.html#mkTyVarTys"><span class="hs-identifier hs-var">mkTyVarTys</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121211"><span class="hs-identifier hs-var">tvs'</span></a></span><span>
</span><span id="line-1070"></span><span>             </span><span id="local-6989586621681121205"><span class="annot"><span class="annottext">co2 :: TcCoercionN
</span><a href="#local-6989586621681121205"><span class="hs-identifier hs-var hs-var">co2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoAxiom Unbranched -&gt; [TcType] -&gt; [TcCoercionN] -&gt; TcCoercionN
</span><a href="GHC.Tc.Types.Evidence.html#mkTcUnbranchedAxInstCo"><span class="hs-identifier hs-var">mkTcUnbranchedAxInstCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Unbranched
</span><a href="#local-6989586621681121217"><span class="hs-identifier hs-var">co_tc</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121206"><span class="hs-identifier hs-var">tys'</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1071"></span><span>             </span><span class="hs-comment">-- co2 : T (ty1,ty2) ~R T7 ty1 ty2</span><span>
</span><span id="line-1072"></span><span>
</span><span id="line-1073"></span><span>             </span><span id="local-6989586621681121203"><span class="annot"><span class="annottext">full_co :: TcCoercionN
</span><a href="#local-6989586621681121203"><span class="hs-identifier hs-var hs-var">full_co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcCoercionN -&gt; TcCoercionN
</span><a href="GHC.Tc.Types.Evidence.html#mkTcSubCo"><span class="hs-identifier hs-var">mkTcSubCo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcCoercionN -&gt; TcCoercionN
</span><a href="GHC.Tc.Types.Evidence.html#mkTcSymCo"><span class="hs-identifier hs-var">mkTcSymCo</span></a></span><span> </span><span class="annot"><span class="annottext">TcCoercionN
</span><a href="#local-6989586621681121209"><span class="hs-identifier hs-var">co1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcCoercionN -&gt; TcCoercionN -&gt; TcCoercionN
</span><a href="GHC.Tc.Types.Evidence.html#mkTcTransCo"><span class="hs-operator hs-var">`mkTcTransCo`</span></a></span><span> </span><span class="annot"><span class="annottext">TcCoercionN
</span><a href="#local-6989586621681121205"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-1074"></span><span>             </span><span class="hs-comment">-- full_co :: pat_rho ~R T7 ty1 ty2</span><span>
</span><span id="line-1075"></span><span>
</span><span id="line-1076"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(HsWrapper, [TcType]) -&gt; TcM (HsWrapper, [TcType])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">TcCoercionN -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#mkWpCastR"><span class="hs-identifier hs-var">mkWpCastR</span></a></span><span> </span><span class="annot"><span class="annottext">TcCoercionN
</span><a href="#local-6989586621681121203"><span class="hs-identifier hs-var">full_co</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper -&gt; HsWrapper -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121214"><span class="hs-identifier hs-var">wrap</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121206"><span class="hs-identifier hs-var">tys'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1077"></span><span>
</span><span id="line-1078"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1079"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121199"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121199"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ExpSigmaType -&gt; TcM TcType
</span><a href="GHC.Tc.Utils.TcMType.html#expTypeToType"><span class="hs-identifier hs-var">expTypeToType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; ExpSigmaType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType
</span><a href="#local-6989586621681121220"><span class="hs-identifier hs-var">exp_pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1080"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121198"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121198"><span class="hs-identifier hs-var">wrap</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121197"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121197"><span class="hs-identifier hs-var">pat_rho</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CtOrigin -&gt; TcType -&gt; TcM (HsWrapper, TcType)
</span><a href="GHC.Tc.Utils.Instantiate.html#topInstantiate"><span class="hs-identifier hs-var">topInstantiate</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621681121222"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121199"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-1081"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121196"><span class="annot"><span class="annottext">TcCoercionN
</span><a href="#local-6989586621681121196"><span class="hs-identifier hs-var">coi</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121195"><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121195"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; TcType -&gt; TcM (TcCoercionN, [TcType])
</span><a href="GHC.Tc.Utils.Unify.html#matchExpectedTyConApp"><span class="hs-identifier hs-var">matchExpectedTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681121221"><span class="hs-identifier hs-var">data_tc</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121197"><span class="hs-identifier hs-var">pat_rho</span></a></span><span>
</span><span id="line-1082"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(HsWrapper, [TcType]) -&gt; TcM (HsWrapper, [TcType])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcCoercionN -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#mkWpCastN"><span class="hs-identifier hs-var">mkWpCastN</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcCoercionN -&gt; TcCoercionN
</span><a href="GHC.Tc.Types.Evidence.html#mkTcSymCo"><span class="hs-identifier hs-var">mkTcSymCo</span></a></span><span> </span><span class="annot"><span class="annottext">TcCoercionN
</span><a href="#local-6989586621681121196"><span class="hs-identifier hs-var">coi</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">HsWrapper -&gt; HsWrapper -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681121198"><span class="hs-identifier hs-var">wrap</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121195"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1083"></span><span>
</span><span id="line-1084"></span><span class="hs-comment">{-
Note [Matching constructor patterns]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppose (coi, tys) = matchExpectedConType data_tc pat_ty

 * In the simple case, pat_ty = tc tys

 * If pat_ty is a polytype, we want to instantiate it
   This is like part of a subsumption check.  Eg
      f :: (forall a. [a]) -&gt; blah
      f [] = blah

 * In a type family case, suppose we have
          data family T a
          data instance T (p,q) = A p | B q
       Then we'll have internally generated
              data T7 p q = A p | B q
              axiom coT7 p q :: T (p,q) ~ T7 p q

       So if pat_ty = T (ty1,ty2), we return (coi, [ty1,ty2]) such that
           coi = coi2 . coi1 : T7 t ~ pat_ty
           coi1 : T (ty1,ty2) ~ pat_ty
           coi2 : T7 ty1 ty2 ~ T (ty1,ty2)

   For families we do all this matching here, not in the unifier,
   because we never want a whisper of the data_tycon to appear in
   error messages; it's a purely internal thing
-}</span><span>
</span><span id="line-1112"></span><span>
</span><span id="line-1113"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcConArgs"><span class="hs-identifier hs-type">tcConArgs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.ConLike.html#ConLike"><span class="hs-identifier hs-type">ConLike</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcSigmaType"><span class="hs-identifier hs-type">TcSigmaType</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1114"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#Checker"><span class="hs-identifier hs-type">Checker</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#HsConPatDetails"><span class="hs-identifier hs-type">HsConPatDetails</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#HsConPatDetails"><span class="hs-identifier hs-type">HsConPatDetails</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1115"></span><span>
</span><span id="line-1116"></span><span id="tcConArgs"><span class="annot"><span class="annottext">tcConArgs :: ConLike
-&gt; [Scaled TcType]
-&gt; Checker (HsConPatDetails GhcRn) (HsConPatDetails GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tcConArgs"><span class="hs-identifier hs-var hs-var">tcConArgs</span></a></span></span><span> </span><span id="local-6989586621681121170"><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681121170"><span class="hs-identifier hs-var">con_like</span></a></span></span><span> </span><span id="local-6989586621681121169"><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121169"><span class="hs-identifier hs-var">arg_tys</span></a></span></span><span> </span><span id="local-6989586621681121168"><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121168"><span class="hs-identifier hs-var">penv</span></a></span></span><span> </span><span id="local-6989586621681121167"><span class="annot"><span class="annottext">HsConPatDetails GhcRn
</span><a href="#local-6989586621681121167"><span class="hs-identifier hs-var">con_args</span></a></span></span><span> </span><span id="local-6989586621681121166"><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121166"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HsConPatDetails GhcRn
</span><a href="#local-6989586621681121167"><span class="hs-identifier hs-var">con_args</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1117"></span><span>  </span><span class="annot"><a href="GHC.Hs.Type.html#PrefixCon"><span class="hs-identifier hs-type">PrefixCon</span></a></span><span> </span><span id="local-6989586621681121164"><span class="annot"><span class="annottext">[LPat GhcRn]
</span><a href="#local-6989586621681121164"><span class="hs-identifier hs-var">arg_pats</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1118"></span><span>        </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#checkTc"><span class="hs-identifier hs-var">checkTc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681121163"><span class="hs-identifier hs-var">con_arity</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681121162"><span class="hs-identifier hs-var">no_of_args</span></a></span><span class="hs-special">)</span><span>     </span><span class="hs-comment">-- Check correct arity</span><span>
</span><span id="line-1119"></span><span>                  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; ConLike -&gt; Int -&gt; Int -&gt; SDoc
forall a. Outputable a =&gt; SDoc -&gt; a -&gt; Int -&gt; Int -&gt; SDoc
</span><a href="GHC.Tc.Validity.html#arityErr"><span class="hs-identifier hs-var">arityErr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;constructor&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681121170"><span class="hs-identifier hs-var">con_like</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681121163"><span class="hs-identifier hs-var">con_arity</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681121162"><span class="hs-identifier hs-var">no_of_args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1120"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681121161"><span class="annot"><span class="annottext">pats_w_tys :: [(GenLocated SrcSpan (Pat GhcRn), Scaled TcType)]
</span><a href="#local-6989586621681121161"><span class="hs-identifier hs-var hs-var">pats_w_tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
-&gt; [GenLocated SrcSpan (Pat GhcRn)]
-&gt; [Scaled TcType]
-&gt; [(GenLocated SrcSpan (Pat GhcRn), Scaled TcType)]
forall a b. String -&gt; [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="GHC.Utils.Misc.html#zipEqual"><span class="hs-identifier hs-var">zipEqual</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcConArgs&quot;</span></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan (Pat GhcRn)]
[LPat GhcRn]
</span><a href="#local-6989586621681121164"><span class="hs-identifier hs-var">arg_pats</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121169"><span class="hs-identifier hs-var">arg_tys</span></a></span><span>
</span><span id="line-1121"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121160"><span class="annot"><span class="annottext">[Located (Pat GhcTc)]
</span><a href="#local-6989586621681121160"><span class="hs-identifier hs-var">arg_pats'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121159"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121159"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Checker
  (GenLocated SrcSpan (Pat GhcRn), Scaled TcType)
  (Located (Pat GhcTc))
-&gt; Checker
     [(GenLocated SrcSpan (Pat GhcRn), Scaled TcType)]
     [Located (Pat GhcTc)]
forall inp out. Checker inp out -&gt; Checker [inp] [out]
</span><a href="GHC.Tc.Gen.Pat.html#tcMultiple"><span class="hs-identifier hs-var">tcMultiple</span></a></span><span> </span><span class="annot"><span class="annottext">Checker
  (GenLocated SrcSpan (Pat GhcRn), Scaled TcType)
  (Located (Pat GhcTc))
Checker (LPat GhcRn, Scaled TcType) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tcConArg"><span class="hs-identifier hs-var">tcConArg</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121168"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">[(GenLocated SrcSpan (Pat GhcRn), Scaled TcType)]
</span><a href="#local-6989586621681121161"><span class="hs-identifier hs-var">pats_w_tys</span></a></span><span>
</span><span id="line-1122"></span><span>                                              </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121166"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-1123"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(HsConDetails
   (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
 r)
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (HsConDetails
        (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
      r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Located (Pat GhcTc)]
-&gt; HsConDetails
     (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc)))
forall arg rec. [arg] -&gt; HsConDetails arg rec
</span><a href="GHC.Hs.Type.html#PrefixCon"><span class="hs-identifier hs-var">PrefixCon</span></a></span><span> </span><span class="annot"><span class="annottext">[Located (Pat GhcTc)]
</span><a href="#local-6989586621681121160"><span class="hs-identifier hs-var">arg_pats'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121159"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1124"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-1125"></span><span>      </span><span id="local-6989586621681121163"><span class="annot"><span class="annottext">con_arity :: Int
</span><a href="#local-6989586621681121163"><span class="hs-identifier hs-var hs-var">con_arity</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConLike -&gt; Int
</span><a href="GHC.Core.ConLike.html#conLikeArity"><span class="hs-identifier hs-var">conLikeArity</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681121170"><span class="hs-identifier hs-var">con_like</span></a></span><span>
</span><span id="line-1126"></span><span>      </span><span id="local-6989586621681121162"><span class="annot"><span class="annottext">no_of_args :: Int
</span><a href="#local-6989586621681121162"><span class="hs-identifier hs-var hs-var">no_of_args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan (Pat GhcRn)] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan (Pat GhcRn)]
[LPat GhcRn]
</span><a href="#local-6989586621681121164"><span class="hs-identifier hs-var">arg_pats</span></a></span><span>
</span><span id="line-1127"></span><span>
</span><span id="line-1128"></span><span>  </span><span class="annot"><a href="GHC.Hs.Type.html#InfixCon"><span class="hs-identifier hs-type">InfixCon</span></a></span><span> </span><span id="local-6989586621681121155"><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121155"><span class="hs-identifier hs-var">p1</span></a></span></span><span> </span><span id="local-6989586621681121154"><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121154"><span class="hs-identifier hs-var">p2</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1129"></span><span>        </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#checkTc"><span class="hs-identifier hs-var">checkTc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681121153"><span class="hs-identifier hs-var">con_arity</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span>      </span><span class="hs-comment">-- Check correct arity</span><span>
</span><span id="line-1130"></span><span>                  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; ConLike -&gt; Int -&gt; Int -&gt; SDoc
forall a. Outputable a =&gt; SDoc -&gt; a -&gt; Int -&gt; Int -&gt; SDoc
</span><a href="GHC.Tc.Validity.html#arityErr"><span class="hs-identifier hs-var">arityErr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;constructor&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681121170"><span class="hs-identifier hs-var">con_like</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681121153"><span class="hs-identifier hs-var">con_arity</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span>
</span><span id="line-1131"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">[</span><span id="local-6989586621681121152"><span class="annot"><span class="annottext">Scaled TcType
</span><a href="#local-6989586621681121152"><span class="hs-identifier hs-var">arg_ty1</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681121151"><span class="annot"><span class="annottext">Scaled TcType
</span><a href="#local-6989586621681121151"><span class="hs-identifier hs-var">arg_ty2</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121169"><span class="hs-identifier hs-var">arg_tys</span></a></span><span>       </span><span class="hs-comment">-- This can't fail after the arity check</span><span>
</span><span id="line-1132"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span id="local-6989586621681121150"><span class="annot"><span class="annottext">Located (Pat GhcTc)
</span><a href="#local-6989586621681121150"><span class="hs-identifier hs-var">p1'</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681121149"><span class="annot"><span class="annottext">Located (Pat GhcTc)
</span><a href="#local-6989586621681121149"><span class="hs-identifier hs-var">p2'</span></a></span></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121148"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121148"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Checker
  (GenLocated SrcSpan (Pat GhcRn), Scaled TcType)
  (Located (Pat GhcTc))
-&gt; Checker
     [(GenLocated SrcSpan (Pat GhcRn), Scaled TcType)]
     [Located (Pat GhcTc)]
forall inp out. Checker inp out -&gt; Checker [inp] [out]
</span><a href="GHC.Tc.Gen.Pat.html#tcMultiple"><span class="hs-identifier hs-var">tcMultiple</span></a></span><span> </span><span class="annot"><span class="annottext">Checker
  (GenLocated SrcSpan (Pat GhcRn), Scaled TcType)
  (Located (Pat GhcTc))
Checker (LPat GhcRn, Scaled TcType) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tcConArg"><span class="hs-identifier hs-var">tcConArg</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121168"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat GhcRn)
LPat GhcRn
</span><a href="#local-6989586621681121155"><span class="hs-identifier hs-var">p1</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Scaled TcType
</span><a href="#local-6989586621681121152"><span class="hs-identifier hs-var">arg_ty1</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat GhcRn)
LPat GhcRn
</span><a href="#local-6989586621681121154"><span class="hs-identifier hs-var">p2</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Scaled TcType
</span><a href="#local-6989586621681121151"><span class="hs-identifier hs-var">arg_ty2</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1133"></span><span>                                                  </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121166"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-1134"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(HsConDetails
   (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
 r)
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (HsConDetails
        (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
      r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located (Pat GhcTc)
-&gt; Located (Pat GhcTc)
-&gt; HsConDetails
     (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc)))
forall arg rec. arg -&gt; arg -&gt; HsConDetails arg rec
</span><a href="GHC.Hs.Type.html#InfixCon"><span class="hs-identifier hs-var">InfixCon</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcTc)
</span><a href="#local-6989586621681121150"><span class="hs-identifier hs-var">p1'</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcTc)
</span><a href="#local-6989586621681121149"><span class="hs-identifier hs-var">p2'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121148"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1135"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-1136"></span><span>      </span><span id="local-6989586621681121153"><span class="annot"><span class="annottext">con_arity :: Int
</span><a href="#local-6989586621681121153"><span class="hs-identifier hs-var hs-var">con_arity</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConLike -&gt; Int
</span><a href="GHC.Core.ConLike.html#conLikeArity"><span class="hs-identifier hs-var">conLikeArity</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681121170"><span class="hs-identifier hs-var">con_like</span></a></span><span>
</span><span id="line-1137"></span><span>
</span><span id="line-1138"></span><span>  </span><span class="annot"><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-type">RecCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#HsRecFields"><span class="hs-identifier hs-type">HsRecFields</span></a></span><span> </span><span id="local-6989586621681121145"><span class="annot"><span class="annottext">[LHsRecField GhcRn (LPat GhcRn)]
</span><a href="#local-6989586621681121145"><span class="hs-identifier hs-var">rpats</span></a></span></span><span> </span><span id="local-6989586621681121144"><span class="annot"><span class="annottext">Maybe (Located Int)
</span><a href="#local-6989586621681121144"><span class="hs-identifier hs-var">dd</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1139"></span><span>        </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121143"><span class="annot"><span class="annottext">[LHsRecField GhcTc (Located (Pat GhcTc))]
</span><a href="#local-6989586621681121143"><span class="hs-identifier hs-var">rpats'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121142"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121142"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Checker
  (LHsRecField GhcRn (GenLocated SrcSpan (Pat GhcRn)))
  (LHsRecField GhcTc (Located (Pat GhcTc)))
-&gt; Checker
     [LHsRecField GhcRn (GenLocated SrcSpan (Pat GhcRn))]
     [LHsRecField GhcTc (Located (Pat GhcTc))]
forall inp out. Checker inp out -&gt; Checker [inp] [out]
</span><a href="GHC.Tc.Gen.Pat.html#tcMultiple"><span class="hs-identifier hs-var">tcMultiple</span></a></span><span> </span><span class="annot"><span class="annottext">Checker
  (LHsRecField GhcRn (GenLocated SrcSpan (Pat GhcRn)))
  (LHsRecField GhcTc (Located (Pat GhcTc)))
Checker
  (LHsRecField GhcRn (LPat GhcRn)) (LHsRecField GhcTc (LPat GhcTc))
</span><a href="#local-6989586621681121141"><span class="hs-identifier hs-var">tc_field</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121168"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsRecField GhcRn (GenLocated SrcSpan (Pat GhcRn))]
[LHsRecField GhcRn (LPat GhcRn)]
</span><a href="#local-6989586621681121145"><span class="hs-identifier hs-var">rpats</span></a></span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121166"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-1140"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(HsConDetails
   (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
 r)
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (HsConDetails
        (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
      r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsRecFields GhcTc (Located (Pat GhcTc))
-&gt; HsConDetails
     (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc)))
forall arg rec. rec -&gt; HsConDetails arg rec
</span><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-var">RecCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[LHsRecField GhcTc (Located (Pat GhcTc))]
-&gt; Maybe (Located Int) -&gt; HsRecFields GhcTc (Located (Pat GhcTc))
forall p arg.
[LHsRecField p arg] -&gt; Maybe (Located Int) -&gt; HsRecFields p arg
</span><a href="GHC.Hs.Pat.html#HsRecFields"><span class="hs-identifier hs-var">HsRecFields</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsRecField GhcTc (Located (Pat GhcTc))]
</span><a href="#local-6989586621681121143"><span class="hs-identifier hs-var">rpats'</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Located Int)
</span><a href="#local-6989586621681121144"><span class="hs-identifier hs-var">dd</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121142"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1141"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-1142"></span><span>      </span><span class="annot"><a href="#local-6989586621681121141"><span class="hs-identifier hs-type">tc_field</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#Checker"><span class="hs-identifier hs-type">Checker</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LHsRecField"><span class="hs-identifier hs-type">LHsRecField</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1143"></span><span>                          </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LHsRecField"><span class="hs-identifier hs-type">LHsRecField</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1144"></span><span>      </span><span id="local-6989586621681121141"><span class="annot"><span class="annottext">tc_field :: Checker
  (LHsRecField GhcRn (LPat GhcRn)) (LHsRecField GhcTc (LPat GhcTc))
</span><a href="#local-6989586621681121141"><span class="hs-identifier hs-var hs-var">tc_field</span></a></span></span><span> </span><span id="local-6989586621681121136"><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121136"><span class="hs-identifier hs-var">penv</span></a></span></span><span>
</span><span id="line-1145"></span><span>               </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681121135"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121135"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#HsRecField"><span class="hs-identifier hs-type">HsRecField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681121133"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121133"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#FieldOcc"><span class="hs-identifier hs-type">FieldOcc</span></a></span><span> </span><span id="local-6989586621681121131"><span class="annot"><span class="annottext">XCFieldOcc GhcRn
</span><a href="#local-6989586621681121131"><span class="hs-identifier hs-var">sel</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681121130"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121130"><span class="hs-identifier hs-var">lr</span></a></span></span><span> </span><span id="local-6989586621681121129"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681121129"><span class="hs-identifier hs-var">rdr</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span id="local-6989586621681121128"><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121128"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span id="local-6989586621681121127"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681121127"><span class="hs-identifier hs-var">pun</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1146"></span><span>               </span><span id="local-6989586621681121126"><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121126"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-1147"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681121125"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681121125"><span class="hs-identifier hs-var">sel'</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM TyVar
</span><a href="GHC.Tc.Utils.Env.html#tcLookupId"><span class="hs-identifier hs-var">tcLookupId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
XCFieldOcc GhcRn
</span><a href="#local-6989586621681121131"><span class="hs-identifier hs-var">sel</span></a></span><span>
</span><span id="line-1148"></span><span>             </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681121123"><span class="annot"><span class="annottext">Scaled TcType
</span><a href="#local-6989586621681121123"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; TcRn (Scaled TcType) -&gt; TcRn (Scaled TcType)
forall a. SrcSpan -&gt; TcRn a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#setSrcSpan"><span class="hs-identifier hs-var">setSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121133"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(TcRn (Scaled TcType) -&gt; TcRn (Scaled TcType))
-&gt; TcRn (Scaled TcType) -&gt; TcRn (Scaled TcType)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; FieldLabelString -&gt; TcRn (Scaled TcType)
</span><a href="#local-6989586621681121122"><span class="hs-identifier hs-var">find_field_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Name
XCFieldOcc GhcRn
</span><a href="#local-6989586621681121131"><span class="hs-identifier hs-var">sel</span></a></span><span>
</span><span id="line-1149"></span><span>                                            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OccName -&gt; FieldLabelString
</span><a href="GHC.Types.Name.Occurrence.html#occNameFS"><span class="hs-identifier hs-var hs-var">occNameFS</span></a></span><span> </span><span class="annot"><span class="annottext">(OccName -&gt; FieldLabelString) -&gt; OccName -&gt; FieldLabelString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; OccName
</span><a href="GHC.Types.Name.Reader.html#rdrNameOcc"><span class="hs-identifier hs-var">rdrNameOcc</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681121129"><span class="hs-identifier hs-var">rdr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1150"></span><span>             </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121119"><span class="annot"><span class="annottext">Located (Pat GhcTc)
</span><a href="#local-6989586621681121119"><span class="hs-identifier hs-var">pat'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121118"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121118"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">PatEnv
-&gt; (LPat GhcRn, Scaled TcType) -&gt; TcM r -&gt; TcM (LPat GhcTc, r)
Checker (LPat GhcRn, Scaled TcType) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tcConArg"><span class="hs-identifier hs-var">tcConArg</span></a></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121136"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121128"><span class="hs-identifier hs-var">pat</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Scaled TcType
</span><a href="#local-6989586621681121123"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcM r
</span><a href="#local-6989586621681121126"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-1151"></span><span>             </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(LHsRecField GhcTc (Located (Pat GhcTc)), r)
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (LHsRecField GhcTc (Located (Pat GhcTc)), r)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan
-&gt; HsRecField' (FieldOcc GhcTc) (Located (Pat GhcTc))
-&gt; LHsRecField GhcTc (Located (Pat GhcTc))
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121135"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located (FieldOcc GhcTc)
-&gt; Located (Pat GhcTc)
-&gt; Bool
-&gt; HsRecField' (FieldOcc GhcTc) (Located (Pat GhcTc))
forall id arg. Located id -&gt; arg -&gt; Bool -&gt; HsRecField' id arg
</span><a href="GHC.Hs.Pat.html#HsRecField"><span class="hs-identifier hs-var">HsRecField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; FieldOcc GhcTc -&gt; Located (FieldOcc GhcTc)
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121133"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XCFieldOcc GhcTc -&gt; GenLocated SrcSpan RdrName -&gt; FieldOcc GhcTc
forall pass.
XCFieldOcc pass -&gt; GenLocated SrcSpan RdrName -&gt; FieldOcc pass
</span><a href="GHC.Hs.Type.html#FieldOcc"><span class="hs-identifier hs-var">FieldOcc</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
XCFieldOcc GhcTc
</span><a href="#local-6989586621681121125"><span class="hs-identifier hs-var">sel'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; RdrName -&gt; GenLocated SrcSpan RdrName
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681121130"><span class="hs-identifier hs-var">lr</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681121129"><span class="hs-identifier hs-var">rdr</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcTc)
</span><a href="#local-6989586621681121119"><span class="hs-identifier hs-var">pat'</span></a></span><span>
</span><span id="line-1152"></span><span>                                                                      </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681121127"><span class="hs-identifier hs-var">pun</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621681121118"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1153"></span><span>
</span><span id="line-1154"></span><span>
</span><span id="line-1155"></span><span>      </span><span class="annot"><a href="#local-6989586621681121122"><span class="hs-identifier hs-type">find_field_ty</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabelString"><span class="hs-identifier hs-type">FieldLabelString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1156"></span><span>      </span><span id="local-6989586621681121122"><span class="annot"><span class="annottext">find_field_ty :: Name -&gt; FieldLabelString -&gt; TcRn (Scaled TcType)
</span><a href="#local-6989586621681121122"><span class="hs-identifier hs-var hs-var">find_field_ty</span></a></span></span><span> </span><span id="local-6989586621681121117"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121117"><span class="hs-identifier hs-var">sel</span></a></span></span><span> </span><span id="local-6989586621681121116"><span class="annot"><span class="annottext">FieldLabelString
</span><a href="#local-6989586621681121116"><span class="hs-identifier hs-var">lbl</span></a></span></span><span>
</span><span id="line-1157"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Scaled TcType
</span><a href="#local-6989586621681121115"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121114"><span class="annot"><span class="annottext">FieldLabel
</span><a href="#local-6989586621681121114"><span class="hs-identifier hs-var">fl</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681121115"><span class="annot"><span class="annottext">Scaled TcType
</span><a href="#local-6989586621681121115"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(FieldLabel, Scaled TcType)]
</span><a href="#local-6989586621681121113"><span class="hs-identifier hs-var">field_tys</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">FieldLabel -&gt; Name
forall a. FieldLbl a -&gt; a
</span><a href="GHC.Types.FieldLabel.html#flSelector"><span class="hs-identifier hs-var hs-var">flSelector</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLabel
</span><a href="#local-6989586621681121114"><span class="hs-identifier hs-var">fl</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Name -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681121117"><span class="hs-identifier hs-var">sel</span></a></span><span> </span><span class="hs-special">]</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1158"></span><span>
</span><span id="line-1159"></span><span>                </span><span class="hs-comment">-- No matching field; chances are this field label comes from some</span><span>
</span><span id="line-1160"></span><span>                </span><span class="hs-comment">-- other record type (or maybe none).  If this happens, just fail,</span><span>
</span><span id="line-1161"></span><span>                </span><span class="hs-comment">-- otherwise we get crashes later (#8570), and similar:</span><span>
</span><span id="line-1162"></span><span>                </span><span class="hs-comment">--      f (R { foo = (a,b) }) = a+b</span><span>
</span><span id="line-1163"></span><span>                </span><span class="hs-comment">-- If foo isn't one of R's fields, we don't want to crash when</span><span>
</span><span id="line-1164"></span><span>                </span><span class="hs-comment">-- typechecking the &quot;a+b&quot;.</span><span>
</span><span id="line-1165"></span><span>           </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; TcRn (Scaled TcType)
forall a. SDoc -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#failWith"><span class="hs-identifier hs-var">failWith</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConLike -&gt; FieldLabelString -&gt; SDoc
</span><a href="GHC.Tc.Gen.Pat.html#badFieldCon"><span class="hs-identifier hs-var">badFieldCon</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681121170"><span class="hs-identifier hs-var">con_like</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLabelString
</span><a href="#local-6989586621681121116"><span class="hs-identifier hs-var">lbl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1166"></span><span>
</span><span id="line-1167"></span><span>                </span><span class="hs-comment">-- The normal case, when the field comes from the right constructor</span><span>
</span><span id="line-1168"></span><span>           </span><span class="hs-special">(</span><span id="local-6989586621681121110"><span class="annot"><span class="annottext">Scaled TcType
</span><a href="#local-6989586621681121110"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681121109"><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121109"><span class="hs-identifier hs-var">extras</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1169"></span><span>                </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;find_field&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled TcType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled TcType
</span><a href="#local-6989586621681121110"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled TcType] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121109"><span class="hs-identifier hs-var">extras</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1170"></span><span>                </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">null</span><span> </span><span class="hs-identifier">extras</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">return</span><span> </span><span class="hs-identifier">pat_ty</span><span class="hs-special">)</span><span>
</span><span id="line-1171"></span><span>
</span><span id="line-1172"></span><span>      </span><span class="annot"><a href="#local-6989586621681121113"><span class="hs-identifier hs-type">field_tys</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1173"></span><span>      </span><span id="local-6989586621681121113"><span class="annot"><span class="annottext">field_tys :: [(FieldLabel, Scaled TcType)]
</span><a href="#local-6989586621681121113"><span class="hs-identifier hs-var hs-var">field_tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[FieldLabel] -&gt; [Scaled TcType] -&gt; [(FieldLabel, Scaled TcType)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConLike -&gt; [FieldLabel]
</span><a href="GHC.Core.ConLike.html#conLikeFieldLabels"><span class="hs-identifier hs-var">conLikeFieldLabels</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681121170"><span class="hs-identifier hs-var">con_like</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Scaled TcType]
</span><a href="#local-6989586621681121169"><span class="hs-identifier hs-var">arg_tys</span></a></span><span>
</span><span id="line-1174"></span><span>          </span><span class="hs-comment">-- Don't use zipEqual! If the constructor isn't really a record, then</span><span>
</span><span id="line-1175"></span><span>          </span><span class="hs-comment">-- dataConFieldLabels will be empty (and each field in the pattern</span><span>
</span><span id="line-1176"></span><span>          </span><span class="hs-comment">-- will generate an error below).</span><span>
</span><span id="line-1177"></span><span>
</span><span id="line-1178"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#tcConArg"><span class="hs-identifier hs-type">tcConArg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#Checker"><span class="hs-identifier hs-type">Checker</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcSigmaType"><span class="hs-identifier hs-type">TcSigmaType</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1179"></span><span id="tcConArg"><span class="annot"><span class="annottext">tcConArg :: Checker (LPat GhcRn, Scaled TcType) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tcConArg"><span class="hs-identifier hs-var hs-var">tcConArg</span></a></span></span><span> </span><span id="local-6989586621681121107"><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121107"><span class="hs-identifier hs-var">penv</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681121106"><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121106"><span class="hs-identifier hs-var">arg_pat</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span id="local-6989586621681121105"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121105"><span class="hs-identifier hs-var">arg_mult</span></a></span></span><span> </span><span id="local-6989586621681121104"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121104"><span class="hs-identifier hs-var">arg_ty</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1180"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Scaled ExpSigmaType -&gt; Checker (LPat GhcRn) (LPat GhcTc)
</span><a href="GHC.Tc.Gen.Pat.html#tc_lpat"><span class="hs-identifier hs-var">tc_lpat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType -&gt; Scaled ExpSigmaType
forall a. TcType -&gt; a -&gt; Scaled a
</span><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-var">Scaled</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121105"><span class="hs-identifier hs-var">arg_mult</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121104"><span class="hs-identifier hs-var">arg_ty</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><a href="#local-6989586621681121107"><span class="hs-identifier hs-var">penv</span></a></span><span> </span><span class="annot"><span class="annottext">LPat GhcRn
</span><a href="#local-6989586621681121106"><span class="hs-identifier hs-var">arg_pat</span></a></span><span>
</span><span id="line-1181"></span><span>
</span><span id="line-1182"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#addDataConStupidTheta"><span class="hs-identifier hs-type">addDataConStupidTheta</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1183"></span><span class="hs-comment">-- Instantiate the &quot;stupid theta&quot; of the data con, and throw</span><span>
</span><span id="line-1184"></span><span class="hs-comment">-- the constraints into the constraint set</span><span>
</span><span id="line-1185"></span><span id="addDataConStupidTheta"><span class="annot"><span class="annottext">addDataConStupidTheta :: DataCon -&gt; [TcType] -&gt; TcRn ()
</span><a href="GHC.Tc.Gen.Pat.html#addDataConStupidTheta"><span class="hs-identifier hs-var hs-var">addDataConStupidTheta</span></a></span></span><span> </span><span id="local-6989586621681121103"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681121103"><span class="hs-identifier hs-var">data_con</span></a></span></span><span> </span><span id="local-6989586621681121102"><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121102"><span class="hs-identifier hs-var">inst_tys</span></a></span></span><span>
</span><span id="line-1186"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[TcType] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121101"><span class="hs-identifier hs-var">stupid_theta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; TcRn ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1187"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtOrigin -&gt; [TcType] -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Instantiate.html#instStupidTheta"><span class="hs-identifier hs-var">instStupidTheta</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621681121100"><span class="hs-identifier hs-var">origin</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121099"><span class="hs-identifier hs-var">inst_theta</span></a></span><span>
</span><span id="line-1188"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1189"></span><span>    </span><span id="local-6989586621681121100"><span class="annot"><span class="annottext">origin :: CtOrigin
</span><a href="#local-6989586621681121100"><span class="hs-identifier hs-var hs-var">origin</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Origin.html#OccurrenceOf"><span class="hs-identifier hs-var">OccurrenceOf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; Name
</span><a href="GHC.Core.DataCon.html#dataConName"><span class="hs-identifier hs-var">dataConName</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681121103"><span class="hs-identifier hs-var">data_con</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1190"></span><span>        </span><span class="hs-comment">-- The origin should always report &quot;occurrence of C&quot;</span><span>
</span><span id="line-1191"></span><span>        </span><span class="hs-comment">-- even when C occurs in a pattern</span><span>
</span><span id="line-1192"></span><span>    </span><span id="local-6989586621681121101"><span class="annot"><span class="annottext">stupid_theta :: [TcType]
</span><a href="#local-6989586621681121101"><span class="hs-identifier hs-var hs-var">stupid_theta</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [TcType]
</span><a href="GHC.Core.DataCon.html#dataConStupidTheta"><span class="hs-identifier hs-var">dataConStupidTheta</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681121103"><span class="hs-identifier hs-var">data_con</span></a></span><span>
</span><span id="line-1193"></span><span>    </span><span id="local-6989586621681121095"><span class="annot"><span class="annottext">univ_tvs :: [TyVar]
</span><a href="#local-6989586621681121095"><span class="hs-identifier hs-var hs-var">univ_tvs</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [TyVar]
</span><a href="GHC.Core.DataCon.html#dataConUnivTyVars"><span class="hs-identifier hs-var">dataConUnivTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681121103"><span class="hs-identifier hs-var">data_con</span></a></span><span>
</span><span id="line-1194"></span><span>    </span><span id="local-6989586621681121093"><span class="annot"><span class="annottext">tenv :: TCvSubst
</span><a href="#local-6989586621681121093"><span class="hs-identifier hs-var hs-var">tenv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; [TcType] -&gt; TCvSubst
HasDebugCallStack =&gt; [TyVar] -&gt; [TcType] -&gt; TCvSubst
</span><a href="GHC.Core.TyCo.Subst.html#zipTvSubst"><span class="hs-identifier hs-var">zipTvSubst</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121095"><span class="hs-identifier hs-var">univ_tvs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyVar] -&gt; [TcType] -&gt; [TcType]
forall b a. [b] -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#takeList"><span class="hs-identifier hs-var">takeList</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121095"><span class="hs-identifier hs-var">univ_tvs</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121102"><span class="hs-identifier hs-var">inst_tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1195"></span><span>         </span><span class="hs-comment">-- NB: inst_tys can be longer than the univ tyvars</span><span>
</span><span id="line-1196"></span><span>         </span><span class="hs-comment">--     because the constructor might have existentials</span><span>
</span><span id="line-1197"></span><span>    </span><span id="local-6989586621681121099"><span class="annot"><span class="annottext">inst_theta :: [TcType]
</span><a href="#local-6989586621681121099"><span class="hs-identifier hs-var hs-var">inst_theta</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; [TcType] -&gt; [TcType]
TCvSubst -&gt; [TcType] -&gt; [TcType]
</span><a href="GHC.Core.TyCo.Subst.html#substTheta"><span class="hs-identifier hs-var">substTheta</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681121093"><span class="hs-identifier hs-var">tenv</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121101"><span class="hs-identifier hs-var">stupid_theta</span></a></span><span>
</span><span id="line-1198"></span><span>
</span><span id="line-1199"></span><span class="hs-comment">{-
Note [Arrows and patterns]
~~~~~~~~~~~~~~~~~~~~~~~~~~
(Oct 07) Arrow notation has the odd property that it involves
&quot;holes in the scope&quot;. For example:
  expr :: Arrow a =&gt; a () Int
  expr = proc (y,z) -&gt; do
          x &lt;- term -&lt; y
          expr' -&lt; x

Here the 'proc (y,z)' binding scopes over the arrow tails but not the
arrow body (e.g 'term').  As things stand (bogusly) all the
constraints from the proc body are gathered together, so constraints
from 'term' will be seen by the tcPat for (y,z).  But we must *not*
bind constraints from 'term' here, because the desugarer will not make
these bindings scope over 'term'.

The Right Thing is not to confuse these constraints together. But for
now the Easy Thing is to ensure that we do not have existential or
GADT constraints in a 'proc', and to short-cut the constraint
simplification for such vanilla patterns so that it binds no
constraints. Hence the 'fast path' in tcConPat; but it's also a good
plan for ordinary vanilla patterns to bypass the constraint
simplification step.

************************************************************************
*                                                                      *
                Note [Pattern coercions]
*                                                                      *
************************************************************************

In principle, these program would be reasonable:

        f :: (forall a. a-&gt;a) -&gt; Int
        f (x :: Int-&gt;Int) = x 3

        g :: (forall a. [a]) -&gt; Bool
        g [] = True

In both cases, the function type signature restricts what arguments can be passed
in a call (to polymorphic ones).  The pattern type signature then instantiates this
type.  For example, in the first case,  (forall a. a-&gt;a) &lt;= Int -&gt; Int, and we
generate the translated term
        f = \x' :: (forall a. a-&gt;a).  let x = x' Int in x 3

From a type-system point of view, this is perfectly fine, but it's *very* seldom useful.
And it requires a significant amount of code to implement, because we need to decorate
the translated pattern with coercion functions (generated from the subsumption check
by tcSub).

So for now I'm just insisting on type *equality* in patterns.  No subsumption.

Old notes about desugaring, at a time when pattern coercions were handled:

A SigPat is a type coercion and must be handled one at a time.  We can't
combine them unless the type of the pattern inside is identical, and we don't
bother to check for that.  For example:

        data T = T1 Int | T2 Bool
        f :: (forall a. a -&gt; a) -&gt; T -&gt; t
        f (g::Int-&gt;Int)   (T1 i) = T1 (g i)
        f (g::Bool-&gt;Bool) (T2 b) = T2 (g b)

We desugar this as follows:

        f = \ g::(forall a. a-&gt;a) t::T -&gt;
            let gi = g Int
            in case t of { T1 i -&gt; T1 (gi i)
                           other -&gt;
            let gb = g Bool
            in case t of { T2 b -&gt; T2 (gb b)
                           other -&gt; fail }}

Note that we do not treat the first column of patterns as a
column of variables, because the coerced variables (gi, gb)
would be of different types.  So we get rather grotty code.
But I don't think this is a common case, and if it was we could
doubtless improve it.

Meanwhile, the strategy is:
        * treat each SigPat coercion (always non-identity coercions)
                as a separate block
        * deal with the stuff inside, and then wrap a binding round
                the result to bind the new variable (gi, gb, etc)


************************************************************************
*                                                                      *
\subsection{Errors and contexts}
*                                                                      *
************************************************************************

Note [Existential check]
~~~~~~~~~~~~~~~~~~~~~~~~
Lazy patterns can't bind existentials.  They arise in two ways:
  * Let bindings      let { C a b = e } in b
  * Twiddle patterns  f ~(C a b) = e
The pe_lazy field of PatEnv says whether we are inside a lazy
pattern (perhaps deeply)

See also Note [Typechecking pattern bindings] in GHC.Tc.Gen.Bind
-}</span><span>
</span><span id="line-1301"></span><span>
</span><span id="line-1302"></span><span id="local-6989586621681122301"><span id="local-6989586621681122302"><span class="annot"><a href="GHC.Tc.Gen.Pat.html#maybeWrapPatCtxt"><span class="hs-identifier hs-type">maybeWrapPatCtxt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#Pat"><span class="hs-identifier hs-type">Pat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681122302"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681122301"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681122302"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681122301"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-1303"></span><span class="hs-comment">-- Not all patterns are worth pushing a context</span><span>
</span><span id="line-1304"></span><span id="maybeWrapPatCtxt"><span class="annot"><span class="annottext">maybeWrapPatCtxt :: forall a b. Pat GhcRn -&gt; (TcM a -&gt; TcM b) -&gt; TcM a -&gt; TcM b
</span><a href="GHC.Tc.Gen.Pat.html#maybeWrapPatCtxt"><span class="hs-identifier hs-var hs-var">maybeWrapPatCtxt</span></a></span></span><span> </span><span id="local-6989586621681121084"><span class="annot"><span class="annottext">Pat GhcRn
</span><a href="#local-6989586621681121084"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span id="local-6989586621681121083"><span class="annot"><span class="annottext">TcM a -&gt; TcM b
</span><a href="#local-6989586621681121083"><span class="hs-identifier hs-var">tcm</span></a></span></span><span> </span><span id="local-6989586621681121082"><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681121082"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-1305"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Pat GhcRn -&gt; Bool
forall {p}. Pat p -&gt; Bool
</span><a href="#local-6989586621681121081"><span class="hs-identifier hs-var">worth_wrapping</span></a></span><span> </span><span class="annot"><span class="annottext">Pat GhcRn
</span><a href="#local-6989586621681121084"><span class="hs-identifier hs-var">pat</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcM a -&gt; TcM b
</span><a href="#local-6989586621681121083"><span class="hs-identifier hs-var">tcm</span></a></span><span> </span><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681121082"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-1306"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; TcM b -&gt; TcM b
forall a. SDoc -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#addErrCtxt"><span class="hs-identifier hs-var">addErrCtxt</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681121079"><span class="hs-identifier hs-var">msg</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM b -&gt; TcM b) -&gt; TcM b -&gt; TcM b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TcM a -&gt; TcM b
</span><a href="#local-6989586621681121083"><span class="hs-identifier hs-var">tcm</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM a -&gt; TcM b) -&gt; TcM a -&gt; TcM b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TcM a -&gt; TcM a
forall a. TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#popErrCtxt"><span class="hs-identifier hs-var">popErrCtxt</span></a></span><span> </span><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681121082"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-1307"></span><span>                               </span><span class="hs-comment">-- Remember to pop before doing thing_inside</span><span>
</span><span id="line-1308"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1309"></span><span>   </span><span id="local-6989586621681121081"><span class="annot"><span class="annottext">worth_wrapping :: Pat p -&gt; Bool
</span><a href="#local-6989586621681121081"><span class="hs-identifier hs-var hs-var">worth_wrapping</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#VarPat"><span class="hs-identifier hs-type">VarPat</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1310"></span><span>   </span><span class="annot"><a href="#local-6989586621681121081"><span class="hs-identifier hs-var">worth_wrapping</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#ParPat"><span class="hs-identifier hs-type">ParPat</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1311"></span><span>   </span><span class="annot"><a href="#local-6989586621681121081"><span class="hs-identifier hs-var">worth_wrapping</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#AsPat"><span class="hs-identifier hs-type">AsPat</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1312"></span><span>   </span><span class="annot"><a href="#local-6989586621681121081"><span class="hs-identifier hs-var">worth_wrapping</span></a></span><span> </span><span class="annot"><span class="annottext">Pat p
</span><span class="hs-identifier">_</span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1313"></span><span>   </span><span id="local-6989586621681121079"><span class="annot"><span class="annottext">msg :: SDoc
</span><a href="#local-6989586621681121079"><span class="hs-identifier hs-var hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;In the pattern:&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Pat GhcRn -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Pat GhcRn
</span><a href="#local-6989586621681121084"><span class="hs-identifier hs-var">pat</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1314"></span><span>
</span><span id="line-1315"></span><span class="hs-comment">-----------------------------------------------</span><span>
</span><span id="line-1316"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#checkExistentials"><span class="hs-identifier hs-type">checkExistentials</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span>   </span><span class="hs-comment">-- existentials</span><span>
</span><span id="line-1317"></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span>    </span><span class="hs-comment">-- argument types</span><span>
</span><span id="line-1318"></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PatEnv"><span class="hs-identifier hs-type">PatEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1319"></span><span>    </span><span class="hs-comment">-- See Note [Existential check]]</span><span>
</span><span id="line-1320"></span><span>    </span><span class="hs-comment">-- See Note [Arrows and patterns]</span><span>
</span><span id="line-1321"></span><span id="checkExistentials"><span class="annot"><span class="annottext">checkExistentials :: [TyVar] -&gt; [TcType] -&gt; PatEnv -&gt; TcRn ()
</span><a href="GHC.Tc.Gen.Pat.html#checkExistentials"><span class="hs-identifier hs-var hs-var">checkExistentials</span></a></span></span><span> </span><span id="local-6989586621681121076"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121076"><span class="hs-identifier hs-var">ex_tvs</span></a></span></span><span> </span><span id="local-6989586621681121075"><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121075"><span class="hs-identifier hs-var">tys</span></a></span></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><span class="hs-identifier">_</span></span><span>
</span><span id="line-1322"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">(TyVar -&gt; Bool) -&gt; [TyVar] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (TyVar -&gt; Bool) -&gt; TyVar -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyVar -&gt; VarSet -&gt; Bool
</span><a href="GHC.Types.Var.Set.html#elemVarSet"><span class="hs-operator hs-var">`elemVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType] -&gt; VarSet
</span><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfTypes"><span class="hs-identifier hs-var">tyCoVarsOfTypes</span></a></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><a href="#local-6989586621681121075"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681121076"><span class="hs-identifier hs-var">ex_tvs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; TcRn ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1323"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#checkExistentials"><span class="hs-identifier hs-var">checkExistentials</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PE"><span class="hs-identifier hs-type">PE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pe_ctxt :: PatEnv -&gt; PatCtxt
</span><a href="GHC.Tc.Gen.Pat.html#pe_ctxt"><span class="hs-identifier hs-var">pe_ctxt</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetPat"><span class="hs-identifier hs-type">LetPat</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">}</span><span class="hs-special">)</span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; TcRn ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1324"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#checkExistentials"><span class="hs-identifier hs-var">checkExistentials</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PE"><span class="hs-identifier hs-type">PE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pe_ctxt :: PatEnv -&gt; PatCtxt
</span><a href="GHC.Tc.Gen.Pat.html#pe_ctxt"><span class="hs-identifier hs-var">pe_ctxt</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LamPat"><span class="hs-identifier hs-type">LamPat</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="GHC.Hs.Expr.html#ProcExpr"><span class="hs-identifier hs-var">ProcExpr</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; TcRn ()
forall a. SDoc -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#failWithTc"><span class="hs-identifier hs-var">failWithTc</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Tc.Gen.Pat.html#existentialProcPat"><span class="hs-identifier hs-var">existentialProcPat</span></a></span><span>
</span><span id="line-1325"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#checkExistentials"><span class="hs-identifier hs-var">checkExistentials</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#PE"><span class="hs-identifier hs-type">PE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pe_lazy :: PatEnv -&gt; Bool
</span><a href="GHC.Tc.Gen.Pat.html#pe_lazy"><span class="hs-identifier hs-var">pe_lazy</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; TcRn ()
forall a. SDoc -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#failWithTc"><span class="hs-identifier hs-var">failWithTc</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Tc.Gen.Pat.html#existentialLazyPat"><span class="hs-identifier hs-var">existentialLazyPat</span></a></span><span>
</span><span id="line-1326"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#checkExistentials"><span class="hs-identifier hs-var">checkExistentials</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[TcType]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">PatEnv
</span><span class="hs-identifier">_</span></span><span>                                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; TcRn ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1327"></span><span>
</span><span id="line-1328"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#existentialLazyPat"><span class="hs-identifier hs-type">existentialLazyPat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1329"></span><span id="existentialLazyPat"><span class="annot"><span class="annottext">existentialLazyPat :: SDoc
</span><a href="GHC.Tc.Gen.Pat.html#existentialLazyPat"><span class="hs-identifier hs-var hs-var">existentialLazyPat</span></a></span></span><span>
</span><span id="line-1330"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;An existential or GADT data constructor cannot be used&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1331"></span><span>       </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;inside a lazy (~) pattern&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1332"></span><span>
</span><span id="line-1333"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#existentialProcPat"><span class="hs-identifier hs-type">existentialProcPat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1334"></span><span id="existentialProcPat"><span class="annot"><span class="annottext">existentialProcPat :: SDoc
</span><a href="GHC.Tc.Gen.Pat.html#existentialProcPat"><span class="hs-identifier hs-var hs-var">existentialProcPat</span></a></span></span><span>
</span><span id="line-1335"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Proc patterns cannot use existential or GADT data constructors&quot;</span></span><span>
</span><span id="line-1336"></span><span>
</span><span id="line-1337"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#badFieldCon"><span class="hs-identifier hs-type">badFieldCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.ConLike.html#ConLike"><span class="hs-identifier hs-type">ConLike</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabelString"><span class="hs-identifier hs-type">FieldLabelString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1338"></span><span id="badFieldCon"><span class="annot"><span class="annottext">badFieldCon :: ConLike -&gt; FieldLabelString -&gt; SDoc
</span><a href="GHC.Tc.Gen.Pat.html#badFieldCon"><span class="hs-identifier hs-var hs-var">badFieldCon</span></a></span></span><span> </span><span id="local-6989586621681121067"><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681121067"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span id="local-6989586621681121066"><span class="annot"><span class="annottext">FieldLabelString
</span><a href="#local-6989586621681121066"><span class="hs-identifier hs-var">field</span></a></span></span><span>
</span><span id="line-1339"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hsep"><span class="hs-identifier hs-var">hsep</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Constructor&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConLike -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681121067"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-1340"></span><span>          </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;does not have field&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FieldLabelString -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLabelString
</span><a href="#local-6989586621681121066"><span class="hs-identifier hs-var">field</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1341"></span><span>
</span><span id="line-1342"></span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#polyPatSig"><span class="hs-identifier hs-type">polyPatSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1343"></span><span id="polyPatSig"><span class="annot"><span class="annottext">polyPatSig :: TcType -&gt; SDoc
</span><a href="GHC.Tc.Gen.Pat.html#polyPatSig"><span class="hs-identifier hs-var hs-var">polyPatSig</span></a></span></span><span> </span><span id="local-6989586621681121063"><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121063"><span class="hs-identifier hs-var">sig_ty</span></a></span></span><span>
</span><span id="line-1344"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Illegal polymorphic type signature in pattern:&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1345"></span><span>       </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcType
</span><a href="#local-6989586621681121063"><span class="hs-identifier hs-var">sig_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1346"></span></pre></body></html>